Class: JSONAPIErrors::HashRenderer
- Inherits:
-
Object
- Object
- JSONAPIErrors::HashRenderer
- Defined in:
- lib/jsonapi_errors/hash_renderer.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
Instance Method Summary collapse
-
#initialize(exception) ⇒ HashRenderer
constructor
A new instance of HashRenderer.
- #render ⇒ Object
Constructor Details
#initialize(exception) ⇒ HashRenderer
Returns a new instance of HashRenderer.
5 6 7 |
# File 'lib/jsonapi_errors/hash_renderer.rb', line 5 def initialize(exception) @exception = exception end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
3 4 5 |
# File 'lib/jsonapi_errors/hash_renderer.rb', line 3 def exception @exception end |
Instance Method Details
#render ⇒ Object
9 10 11 12 13 |
# File 'lib/jsonapi_errors/hash_renderer.rb', line 9 def render return unhandled_exception_error unless data = JSONAPIErrors::Configuration.matches.fetch(@exception.class.to_s, false) data.reverse_merge!({title: @exception.class.to_s, detail: @exception., status: "500"}) {errors: [data]} end |