class DTK::Error
Constants
- CallerOffset
- DefaultCallerDepth
Public Class Methods
new(msg="",name_or_opts=nil)
click to toggle source
Calls superclass method
# File lib/errors/errors.rb, line 24 def initialize(msg="",name_or_opts=nil) name = nil opts = Hash.new if name_or_opts.kind_of?(Hash) opts = name_or_opts else name = name_or_opts end super(msg,name) #TODO: might make default to be :log_error => false unless opts.has_key?(:log_error) and not opts[:log_error] if caller_info = opts[:caller_info] caller_depth = (caller_info.kind_of?(Hash) ? caller_info[:depth] : nil)||DefaultCallerDepth Log.info_pp(caller[CallerOffset,caller_depth]) end end end
top_error_in_hash()
click to toggle source
# File lib/errors/errors.rb, line 21 def self.top_error_in_hash() {:error => :Error} end
Public Instance Methods
to_hash()
click to toggle source
# File lib/errors/errors.rb, line 44 def to_hash() if to_s == "" Error.top_error_in_hash() elsif name.nil? {:error => {:Error => {:msg => to_s}}} else {:error => {name.to_sym => {:msg => to_s}}} end end