Exception: Card::Error
- Inherits:
-
StandardError
- Object
- Exception
- StandardError
- Card::Error
- Defined in:
- lib/card/error.rb
Overview
exceptions and errors. (arguably most of these should be Card::Exception)
Direct Known Subclasses
Defined Under Namespace
Classes: Abort, BadAddress, BadQuery, CodenameNotFound, EditConflict, NotFound, PermissionDenied, ServerError, UserError
Constant Summary collapse
- KEY_MAP =
{ permission_denied: PermissionDenied, conflict: EditConflict }.freeze
Constants inherited from StandardError
StandardError::MAX_BACKTRACE_LINES
Instance Attribute Summary collapse
- #backtrace ⇒ Object
-
#card ⇒ Object
Returns the value of attribute card.
Class Method Summary collapse
Instance Method Summary collapse
- #card_message_text ⇒ Object
-
#initialize(message = nil) ⇒ Error
constructor
A new instance of Error.
- #message_from_card ⇒ Object
Methods inherited from StandardError
Constructor Details
Instance Attribute Details
#backtrace ⇒ Object
37 38 39 |
# File 'lib/card/error.rb', line 37 def backtrace @backtrace || super end |
#card ⇒ Object
Returns the value of attribute card.
23 24 25 |
# File 'lib/card/error.rb', line 23 def card @card end |
Class Method Details
.report(exception, card) ⇒ Object
130 131 132 133 134 135 |
# File 'lib/card/error.rb', line 130 def report exception, card e = cardify_exception exception, card self.current = e e.report e end |
.rescue_card(card) ⇒ Object
137 138 139 140 141 |
# File 'lib/card/error.rb', line 137 def rescue_card card yield rescue StandardError => e report e, card end |
Instance Method Details
#card_message_text ⇒ Object
41 42 43 |
# File 'lib/card/error.rb', line 41 def card.errors.first&. end |
#message_from_card ⇒ Object
33 34 35 |
# File 'lib/card/error.rb', line 33 def ::I18n.t :lib_exception_for_card, cardname: card.name, message: end |