From 4e84430145b548b0cc32a01105ad318a0b09a82a Mon Sep 17 00:00:00 2001 From: Brian Lopez Date: Wed, 15 Jun 2011 17:27:37 -0700 Subject: [PATCH] process the result outside of the rescue block so we can raise our own exceptions properly --- ext/mysql2/client.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ext/mysql2/client.c b/ext/mysql2/client.c index be12b3225..ed090ae30 100644 --- a/ext/mysql2/client.c +++ b/ext/mysql2/client.c @@ -326,6 +326,7 @@ static VALUE disconnect_and_raise(VALUE self, VALUE error) { shutdown(wrapper->client->net.fd, 2); rb_exc_raise(error); + return Qnil; } #endif @@ -380,7 +381,7 @@ static VALUE do_query(void *args) { } } - return rb_mysql_client_async_result(async_args->self); + return Qnil; } static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) { @@ -434,7 +435,9 @@ static VALUE rb_mysql_client_query(int argc, VALUE * argv, VALUE self) { async_args.fd = wrapper->client->net.fd; async_args.self = self; - return rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0); + rb_rescue2(do_query, (VALUE)&async_args, disconnect_and_raise, self, rb_eException, (VALUE)0); + + return rb_mysql_client_async_result(self); } else { return Qnil; }