Class: ActionController::Twirp::ErrorRenderer
- Inherits:
-
Object
- Object
- ActionController::Twirp::ErrorRenderer
- Defined in:
- lib/action_controller/twirp/error_renderer.rb
Overview
Convert Twirp::Error to #render option
Instance Method Summary collapse
-
#initialize(content, options) ⇒ ErrorRenderer
constructor
A new instance of ErrorRenderer.
- #to_render_option ⇒ Object
Constructor Details
#initialize(content, options) ⇒ ErrorRenderer
Returns a new instance of ErrorRenderer.
9 10 11 12 13 14 15 16 |
# File 'lib/action_controller/twirp/error_renderer.rb', line 9 def initialize(content, ) unless content.is_a?(Exception) raise ArgumentError, 'Instance of Exception class can be specified' end @content = content = .dup end |
Instance Method Details
#to_render_option ⇒ Object
18 19 20 21 22 23 |
# File 'lib/action_controller/twirp/error_renderer.rb', line 18 def to_render_option { json: twirp_error.to_h, **.merge(status: status, content_type: content_type) } end |