Module: FPM::Fry::WithData
- Included in:
- Client::ContainerNotFound, Client::FileNotFound, Client::NotAFile, Exec::Failed, Source::Archive::UnknownArchiveType, Source::CacheFailed
- Defined in:
- lib/fpm/fry/with_data.rb
Overview
Adds a data method to an exception. This overrides initialize so it may not work everywhere.
Instance Attribute Summary collapse
-
#data ⇒ Hash
readonly
Debugging/logging data.
Instance Method Summary collapse
Instance Attribute Details
#data ⇒ Hash (readonly)
Returns debugging/logging data.
24 25 26 |
# File 'lib/fpm/fry/with_data.rb', line 24 def data @data end |
Instance Method Details
#initialize(data = {}) ⇒ Object #initialize(cause, data = {}) ⇒ Object #initialize(message, data = {}) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# 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.) else @data = data.dup.freeze super(e.to_s) end end |