Permalink
Browse files

fix exception translation

  • Loading branch information...
1 parent 9bc303c commit 1543863548bcd7515fac7b7b1931b6e23fedf80f @tenderlove tenderlove committed Jan 15, 2014
@@ -349,11 +349,12 @@ def close
protected
- def translate_exception(e, sql)
+ def translate_exception_class(e, sql)
message = "#{e.class.name}: #{e.message}: #{sql}"
@logger.error message if @logger
exception = translate_exception(e, message)
exception.set_backtrace e.backtrace
+ exception
end
def log(sql, name = "SQL", binds = [], statement_name = nil)
@@ -365,7 +366,7 @@ def log(sql, name = "SQL", binds = [], statement_name = nil)
:statement_name => statement_name,
:binds => binds) { yield }
rescue => e
- raise translate_exception(e, sql)
+ raise translate_exception_class(e, sql)
end
def translate_exception(exception, message)
@@ -856,7 +856,7 @@ def prepare_statement(sql)
begin
@connection.prepare nextkey, sql
rescue => e
- raise translate_exception(e, sql)
+ raise translate_exception_class(e, sql)
end
# Clear the queue
@connection.get_last_result

0 comments on commit 1543863

Please sign in to comment.