Exception: TypedCache::StoreError
- Defined in:
- lib/typed_cache/errors.rb
Overview
Store operation errors (network, I/O, etc.)
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#operation ⇒ Object
readonly
Returns the value of attribute operation.
-
#original_error ⇒ Object
readonly
Returns the value of attribute original_error.
Instance Method Summary collapse
- #detailed_message ⇒ Object
- #has_cause? ⇒ Boolean
-
#initialize(operation, key, message, original_error = nil) ⇒ StoreError
constructor
A new instance of StoreError.
Constructor Details
#initialize(operation, key, message, original_error = nil) ⇒ StoreError
18 19 20 21 22 23 24 25 |
# File 'lib/typed_cache/errors.rb', line 18 def initialize(operation, key, , original_error = nil) super() @operation = operation @key = key @original_error = original_error set_backtrace(original_error.backtrace) if original_error end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
15 16 17 |
# File 'lib/typed_cache/errors.rb', line 15 def key @key end |
#operation ⇒ Object (readonly)
Returns the value of attribute operation.
15 16 17 |
# File 'lib/typed_cache/errors.rb', line 15 def operation @operation end |
#original_error ⇒ Object (readonly)
Returns the value of attribute original_error.
15 16 17 |
# File 'lib/typed_cache/errors.rb', line 15 def original_error @original_error end |
Instance Method Details
#detailed_message ⇒ Object
28 29 30 31 |
# File 'lib/typed_cache/errors.rb', line 28 def base = "#{operation.upcase} operation failed for key '#{key}': #{}" original_error ? "#{base} (#{original_error.class}: #{original_error.})" : base end |
#has_cause? ⇒ Boolean
34 35 36 |
# File 'lib/typed_cache/errors.rb', line 34 def has_cause? !@original_error.nil? end |