Exception: ViewModel::Error
- Inherits:
-
AbstractError
- Object
- StandardError
- AbstractError
- ViewModel::Error
- Defined in:
- lib/view_model/error.rb
Overview
Implementation of ViewModel::AbstractError with constructor parameters for each error data field.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(status: 400, detail: 'ViewModel Error', title: nil, code: nil, meta: {}) ⇒ Error
constructor
A new instance of Error.
Methods inherited from AbstractError
#aggregation?, #causes, #exception, #to_s, #view
Constructor Details
#initialize(status: 400, detail: 'ViewModel Error', title: nil, code: nil, meta: {}) ⇒ Error
Returns a new instance of Error.
185 186 187 188 189 190 191 192 |
# File 'lib/view_model/error.rb', line 185 def initialize(status: 400, detail: 'ViewModel Error', title: nil, code: nil, meta: {}) @detail = detail @status = status @title = title @code = code @meta = super() end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
183 184 185 |
# File 'lib/view_model/error.rb', line 183 def code @code end |
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
183 184 185 |
# File 'lib/view_model/error.rb', line 183 def detail @detail end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
183 184 185 |
# File 'lib/view_model/error.rb', line 183 def @meta end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
183 184 185 |
# File 'lib/view_model/error.rb', line 183 def status @status end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
183 184 185 |
# File 'lib/view_model/error.rb', line 183 def title @title end |