Class: Norn::FailurePayload
- Inherits:
-
Object
- Object
- Norn::FailurePayload
- Defined in:
- lib/norn/errors.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #backtrace ⇒ Object
-
#initialize(error, context = {}) ⇒ FailurePayload
constructor
A new instance of FailurePayload.
- #message ⇒ Object
- #with_context(additional_context) ⇒ Object
Constructor Details
#initialize(error, context = {}) ⇒ FailurePayload
Returns a new instance of FailurePayload.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/norn/errors.rb', line 19 def initialize(error, context = {}) @error = case error when String Norn::Error.new(error) when Exception error else Norn::Error.new(error.to_s) end # 1. Early scan the error message to discover and cache keys in memory Norn::SecretScrubber.scrub(@error.) # 2. Sanitize context with all cached keys loaded @context = sanitize_context(context || {}) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
17 18 19 |
# File 'lib/norn/errors.rb', line 17 def context @context end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
17 18 19 |
# File 'lib/norn/errors.rb', line 17 def error @error end |
Instance Method Details
#backtrace ⇒ Object
44 45 46 |
# File 'lib/norn/errors.rb', line 44 def backtrace @error.backtrace end |
#message ⇒ Object
40 41 42 |
# File 'lib/norn/errors.rb', line 40 def scrub(@error.) end |
#with_context(additional_context) ⇒ Object
36 37 38 |
# File 'lib/norn/errors.rb', line 36 def with_context(additional_context) self.class.new(@error, @context.merge(additional_context || {})) end |