class SP::Duh::Exceptions::GenericError

Generic errors

Attributes

nested[R]
raw_backtrace[R]

Public Class Methods

new(message = nil, nested = $!) click to toggle source
Calls superclass method
# File lib/sp/duh/exceptions.rb, line 32
def initialize(message = nil, nested = $!)
  if message.nil?
    message = I18n.t("sp-duh.exceptions.#{type.underscore.gsub('/','.')}") if I18n.exists?("sp-duh.exceptions.#{type.underscore.gsub('/','.')}")
  end
  super(message)
  @nested = nested
end

Public Instance Methods

set_backtrace(backtrace) click to toggle source
Calls superclass method
# File lib/sp/duh/exceptions.rb, line 40
def set_backtrace(backtrace)
  @raw_backtrace = backtrace
  if nested
    backtrace = backtrace - nested_raw_backtrace
    backtrace += ["#{nested.backtrace.first}: #{nested.message} (#{nested.class.name})"]
    backtrace += nested.backtrace[1..-1] || []
  end
  super(backtrace)
end

Protected Instance Methods

type() click to toggle source
# File lib/sp/duh/exceptions.rb, line 52
def type ; self.class.name.sub("SP::Duh::", "").sub("Exceptions::", "") ; end

Private Instance Methods

nested_raw_backtrace() click to toggle source
# File lib/sp/duh/exceptions.rb, line 56
def nested_raw_backtrace
  nested.respond_to?(:raw_backtrace) ? nested.raw_backtrace : nested.backtrace
end