Method: Sequel::SequelMethods#convert_exception_class

Defined in:
lib/sequel/core.rb

#convert_exception_class(exception, klass) ⇒ Object

Convert the exception to the given class. The given class should be Sequel::Error or a subclass. Returns an instance of klass with the message and backtrace of exception.



136
137
138
139
140
141
142
# File 'lib/sequel/core.rb', line 136

def convert_exception_class(exception, klass)
  return exception if exception.is_a?(klass)
  e = klass.new("#{exception.class}: #{exception.message}")
  e.wrapped_exception = exception
  e.set_backtrace(exception.backtrace)
  e
end