Exception: Sequel::DatabaseError

Inherits:
Error show all
Defined in:
lib/sequel/exceptions.rb,
lib/sequel/extensions/error_sql.rb

Overview

Generic error raised by the database adapters, indicating a problem originating from the database server. Usually raised because incorrect SQL syntax is used.

Constant Summary

Constants inherited from Error

Error::AdapterNotFound, Error::InvalidOperation, Error::InvalidValue, Error::PoolTimeoutError, Error::Rollback

Instance Attribute Summary

Attributes inherited from Error

#wrapped_exception

Instance Method Summary collapse

Instance Method Details

#sqlObject

Get the SQL code that caused this error to be raised.



34
35
36
37
38
39
40
41
# File 'lib/sequel/extensions/error_sql.rb', line 34

def sql
  # We store the error SQL in the wrapped exception instead of the
  # current exception, since when the error SQL is originally associated
  # with the wrapped exception, the current exception doesn't exist.  It's
  # possible to copy the error SQL into the current exception, but there
  # doesn't seem to be a reason to do that.
  wrapped_exception.instance_variable_get(:@sequel_error_sql) if wrapped_exception
end