Sha256: 29679650c1ee2c308daaf340ab01acb25063e1051f2858179219e449724a1366
Contents?: true
Size: 800 Bytes
Versions: 1
Compression:
Stored size: 800 Bytes
Contents
# Provices a wrapping a caught exception inside a new exception. # The original exception is optionally passed in as the cause parameter of the constructor # see: http://ruby.runpaint.org/exceptions # see: http://en.wikipedia.org/wiki/Exception_chaining # see: http://www.ruby-forum.com/topic/148193 # see: http://jqr.github.com/2009/02/11/passing-data-with-ruby-exceptions.html module LyberCore module Exceptions class ChainedError < StandardError def initialize(message, cause=nil) if (cause && cause.is_a?(Exception)) # exaample: "My message; caused by #<Interrupt: interrupt message>" super("#{message}; caused by #{cause.inspect}") self.set_backtrace(cause.backtrace) else super(message) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lyber-core-1.3.0 | lib/lyber_core/exceptions/chained_error.rb |