Exception: ViewModel::Error

Inherits:
AbstractError show all
Defined in:
lib/view_model/error.rb

Overview

Implementation of ViewModel::AbstractError with constructor parameters for each error data field.

Instance Attribute Summary collapse

Instance Method Summary collapse

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   = meta
  super()
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



183
184
185
# File 'lib/view_model/error.rb', line 183

def code
  @code
end

#detailObject (readonly)

Returns the value of attribute detail.



183
184
185
# File 'lib/view_model/error.rb', line 183

def detail
  @detail
end

#metaObject (readonly)

Returns the value of attribute meta.



183
184
185
# File 'lib/view_model/error.rb', line 183

def meta
  @meta
end

#statusObject (readonly)

Returns the value of attribute status.



183
184
185
# File 'lib/view_model/error.rb', line 183

def status
  @status
end

#titleObject (readonly)

Returns the value of attribute title.



183
184
185
# File 'lib/view_model/error.rb', line 183

def title
  @title
end