Exception: ViewModel::WrappedExceptionError

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

Overview

Error type to wrap an arbitrary exception as a renderable ViewModel::AbstractError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractError

#aggregation?, #causes, #meta, #title, #to_s, #view

Constructor Details

#initialize(exception, status, code) ⇒ WrappedExceptionError

Returns a new instance of WrappedExceptionError.



164
165
166
167
168
169
# File 'lib/view_model/error.rb', line 164

def initialize(exception, status, code)
  @exception = exception
  @status    = status
  @code      = code
  super()
end

Instance Attribute Details

#exceptionObject (readonly)

Returns the value of attribute exception.



162
163
164
# File 'lib/view_model/error.rb', line 162

def exception
  @exception
end

#statusObject (readonly)

Returns the value of attribute status.



162
163
164
# File 'lib/view_model/error.rb', line 162

def status
  @status
end

Instance Method Details

#codeObject



175
176
177
# File 'lib/view_model/error.rb', line 175

def code
  @code || "Exception.#{exception.class.name}"
end

#detailObject



171
172
173
# File 'lib/view_model/error.rb', line 171

def detail
  exception.message
end