diff options
author | Josh Haberman <jhaberman@gmail.com> | 2015-07-15 11:05:10 -0700 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2015-07-16 12:25:55 -0700 |
commit | 181c7f26360429b236ab833c746d10d97811931f (patch) | |
tree | 3abdbaf4abb0115c17892bcf2a1629c9475f147c /ruby/ext/google/protobuf_c/encode_decode.c | |
parent | fde6e89f99eda04a4f1b8677bcea07e6c2040405 (diff) | |
download | protobuf-181c7f26360429b236ab833c746d10d97811931f.tar.gz protobuf-181c7f26360429b236ab833c746d10d97811931f.tar.bz2 protobuf-181c7f26360429b236ab833c746d10d97811931f.zip |
Added Ruby to conformance tests.
This involved fixing a few important bugs in the
Ruby implementation -- mostly cases of mixing
upb field types and descriptor types (upb field
types do not distinguish between int/sint/fixed/sfixed
like descriptor types do).
Also added protobuf-specific exceptions so parse
errors can be caught specifically.
Change-Id: Ib49d3db976900b2c6f3455c8b88af52cfb86e036
Diffstat (limited to 'ruby/ext/google/protobuf_c/encode_decode.c')
-rw-r--r-- | ruby/ext/google/protobuf_c/encode_decode.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ruby/ext/google/protobuf_c/encode_decode.c b/ruby/ext/google/protobuf_c/encode_decode.c index f789f6d4..e488f05b 100644 --- a/ruby/ext/google/protobuf_c/encode_decode.c +++ b/ruby/ext/google/protobuf_c/encode_decode.c @@ -656,8 +656,10 @@ static bool env_error_func(void* ud, const upb_status* status) { // Free the env -- rb_raise will longjmp up the stack past the encode/decode // function so it would not otherwise have been freed. stackenv_uninit(se); - rb_raise(rb_eRuntimeError, se->ruby_error_template, - upb_status_errmsg(status)); + + // TODO(haberman): have a way to verify that this is actually a parse error, + // instead of just throwing "parse error" unconditionally. + rb_raise(cParseError, se->ruby_error_template, upb_status_errmsg(status)); // Never reached: rb_raise() always longjmp()s up the stack, past all of our // code, back to Ruby. return false; |