diff --git a/contrib/ruby/ext/trilogy-ruby/cext.c b/contrib/ruby/ext/trilogy-ruby/cext.c index 69f84511..e42297b0 100644 --- a/contrib/ruby/ext/trilogy-ruby/cext.c +++ b/contrib/ruby/ext/trilogy-ruby/cext.c @@ -133,7 +133,8 @@ static void handle_trilogy_error(struct trilogy_ctx *ctx, int rc, const char *ms rb_raise(Trilogy_TimeoutError, "%" PRIsVALUE, rbmsg); case TRILOGY_ERR: { - VALUE message = rb_str_new(ctx->conn.error_message, ctx->conn.error_message_len); + VALUE conn_message = rb_str_new(ctx->conn.error_message, ctx->conn.error_message_len); + VALUE message = rb_sprintf("%" PRIsVALUE " (%" PRIsVALUE ")", conn_message, rbmsg); VALUE exc = rb_funcall(Trilogy_ProtocolError, id_from_code, 2, message, INT2NUM(ctx->conn.error_code)); rb_exc_raise(exc); } diff --git a/contrib/ruby/test/client_test.rb b/contrib/ruby/test/client_test.rb index f9aac0e7..b6f7bfff 100644 --- a/contrib/ruby/test/client_test.rb +++ b/contrib/ruby/test/client_test.rb @@ -270,6 +270,7 @@ def test_trilogy_set_server_option_with_invalid_option assert_instance_of(Trilogy::ProtocolError, e) assert_match(/1047: Unknown command/, e.message) + assert_match(/trilogy_set_option_recv/, e.message) end def test_trilogy_set_server_option_multi_statement @@ -283,6 +284,7 @@ def test_trilogy_set_server_option_multi_statement assert_instance_of(Trilogy::QueryError, e) assert_match(/1064: You have an error in your SQL syntax/, e.message) + assert_match(/trilogy_query_recv/, e.message) client.set_server_option(Trilogy::SET_SERVER_MULTI_STATEMENTS_ON) client.query("INSERT INTO trilogy_test (int_test) VALUES ('4'); INSERT INTO trilogy_test (int_test) VALUES ('1')") @@ -301,6 +303,7 @@ def test_trilogy_set_server_option_multi_statement assert_instance_of(Trilogy::QueryError, e) assert_match(/1064: You have an error in your SQL syntax/, e.message) + assert_match(/trilogy_query_recv/, e.message) end def test_trilogy_query_result_object