Skip to content

Commit

Permalink
process the result outside of the rescue block so we can raise our ow…
Browse files Browse the repository at this point in the history
…n exceptions properly
  • Loading branch information
brianmario committed Jun 16, 2011
1 parent 9221478 commit 4e84430
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ext/mysql2/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 4e84430

Please sign in to comment.