| Module | Sequel::ErrorSQL |
| In: |
lib/sequel/extensions/error_sql.rb
|
If there are no loggers for this database and an exception is raised store the SQL related to the exception with the exception, so it is available for DatabaseError#sql later.
# File lib/sequel/extensions/error_sql.rb, line 60
60: def log_connection_yield(sql, conn, args=nil)
61: if @loggers.empty?
62: begin
63: yield
64: rescue => e
65: sql = "#{connection_info(conn) if conn && log_connection_info}#{sql}#{"; #{args.inspect}" if args}"
66: e.instance_variable_set(:@sequel_error_sql, sql)
67: raise
68: end
69: else
70: super
71: end
72: end
Store the SQL related to the exception with the exception, so it is available for DatabaseError#sql later.
# File lib/sequel/extensions/error_sql.rb, line 52
52: def log_exception(exception, message)
53: exception.instance_variable_set(:@sequel_error_sql, message)
54: super
55: end