Exception: Toolx::Core::Errors::ApiError
- Defined in:
- lib/toolx/core/errors/api_error.rb
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Returns the value of attribute details.
Attributes included from NestedError
Instance Method Summary collapse
-
#initialize(details = nil) ⇒ ApiError
constructor
A new instance of ApiError.
- #message_namespace ⇒ Object
- #status ⇒ Object
Methods included from NestedError
Constructor Details
#initialize(details = nil) ⇒ ApiError
Returns a new instance of ApiError.
7 8 9 10 |
# File 'lib/toolx/core/errors/api_error.rb', line 7 def initialize(details = nil) @details = details || {} super(@details[:message] || error_name) end |
Instance Attribute Details
#details ⇒ Object (readonly)
Returns the value of attribute details.
5 6 7 |
# File 'lib/toolx/core/errors/api_error.rb', line 5 def details @details end |
Instance Method Details
#message_namespace ⇒ Object
12 13 14 |
# File 'lib/toolx/core/errors/api_error.rb', line 12 def @message_namespace ||= self.class.to_s.deconstantize.underscore.tr!('/', '.') end |
#status ⇒ Object
16 17 18 |
# File 'lib/toolx/core/errors/api_error.rb', line 16 def status @status ||= details[:status] || error_name.to_sym end |