module SmartError

Constants

VERSION

Public Class Methods

config() { |self| ... } click to toggle source
# File lib/smart_error.rb, line 37
def self.config
  yield self
end
handle(error, options = nil) click to toggle source
# File lib/smart_error.rb, line 24
def self.handle(error, options = nil)
  case error
  when Integer
    SmartError::CustomError.new(error, options)
  when Exception
    SmartError::ExceptionError.new(error, options)
  when ApplicationRecord, ActiveRecord
    SmartError::ModelError.new(error, options)
  else
    SmartError::CustomError.new(1000, options)
  end
end