module FPM::Fry::WithData
Adds a data method to an exception. This overrides initialize so it may not work everywhere.
Attributes
data[R]
@return [Hash] debugging/logging data
Public Class Methods
new(e=self.class.name, data = {})
click to toggle source
@overload initialize(data = {})
@param data [Hash]
@overload initialize(cause, data = {})
If cause responds to #data the data will be merged. @param cause [Exception] @param data [Hash]
@overload initialize(message, data = {})
@param message [String] @param data [Hash]
Calls superclass method
# File lib/fpm/fry/with_data.rb, line 38 def initialize(e=self.class.name, data = {}) if e.kind_of? Exception if e.respond_to? :data @data = e.data.merge(data) else @data = data.dup.freeze end super(e.message) else @data = data.dup.freeze super(e.to_s) end end