Sha256: 567b079d48cbfbf0328455248581e6968dc5647ca293aaef895e3bb754a34efc
Contents?: true
Size: 950 Bytes
Versions: 1
Compression:
Stored size: 950 Bytes
Contents
module Xio class Error < StandardError def initialize(error_or_message) if error_or_message.is_a?(Exception) @error = error_or_message else @message = error_or_message end end def message @message || "#{@error.class} (wrapped in a #{self.class}) - #{@error.message}" end def backtrace if @error error_backtrace = ["--- Backtrace from #{@error.class} ---"] + (@error.backtrace || []) wrapper_backtrace = ["--- Backtrace from #{self.class} ---"] + (super || []) error_backtrace + wrapper_backtrace else super end end def inspect if @error "#{@error.inspect} (wrapped in a #{self.class})" else super end end def to_s if @error "#{@error.class} (wrapped in a #{self.class}) - #{@error}" else super end end end class HTTPError < Error; end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xio-1.0.0 | lib/xio/errors.rb |