module Sequel::ErrorSQL

  1. lib/sequel/extensions/error_sql.rb

Methods

Public Instance

  1. log_connection_yield
  2. log_exception

Public Instance methods

log_connection_yield(sql, conn, args=nil)

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.

[show source]
   # File lib/sequel/extensions/error_sql.rb
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
log_exception(exception, message)

Store the SQL related to the exception with the exception, so it is available for DatabaseError#sql later.

[show source]
   # File lib/sequel/extensions/error_sql.rb
52 def log_exception(exception, message)
53   exception.instance_variable_set(:@sequel_error_sql, message)
54   super
55 end