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.



183
184
185
186
187
188
189
190
# File 'lib/view_model/error.rb', line 183

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.



181
182
183
# File 'lib/view_model/error.rb', line 181

def code
  @code
end

#detailObject (readonly)

Returns the value of attribute detail.



181
182
183
# File 'lib/view_model/error.rb', line 181

def detail
  @detail
end

#metaObject (readonly)

Returns the value of attribute meta.



181
182
183
# File 'lib/view_model/error.rb', line 181

def meta
  @meta
end

#statusObject (readonly)

Returns the value of attribute status.



181
182
183
# File 'lib/view_model/error.rb', line 181

def status
  @status
end

#titleObject (readonly)

Returns the value of attribute title.



181
182
183
# File 'lib/view_model/error.rb', line 181

def title
  @title
end