Class: Grape::DSL::RescueOptions
- Inherits:
-
Data
- Object
- Data
- Grape::DSL::RescueOptions
- Defined in:
- lib/grape/dsl/rescue_options.rb
Overview
Immutable value object holding the response-shaping booleans accepted by Grape::DSL::RequestResponse#rescue_from. Stored on the inheritable settings as namespace_stackable[:rescue_options] and delegated to by Grape::Middleware::Error (which forwards backtrace/original_exception to the formatter as include_backtrace/include_original_exception).
Defaults are duplicated on #initialize here and on #rescue_from‘s signature on purpose: keeping them on both sides means each entry point is self-documenting without needing to import a shared constant — the DSL signature shows what a user sees in the IDE, and the Data object has working defaults when constructed directly (middleware `DEFAULT_OPTIONS`, spec fixtures, etc.). The two must stay in lockstep.
Instance Attribute Summary collapse
-
#backtrace ⇒ Object
readonly
Returns the value of attribute backtrace.
-
#original_exception ⇒ Object
readonly
Returns the value of attribute original_exception.
Instance Method Summary collapse
-
#initialize(backtrace: false, original_exception: false) ⇒ RescueOptions
constructor
A new instance of RescueOptions.
Constructor Details
#initialize(backtrace: false, original_exception: false) ⇒ RescueOptions
Returns a new instance of RescueOptions.
19 20 21 |
# File 'lib/grape/dsl/rescue_options.rb', line 19 def initialize(backtrace: false, original_exception: false) super end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace
18 19 20 |
# File 'lib/grape/dsl/rescue_options.rb', line 18 def backtrace @backtrace end |
#original_exception ⇒ Object (readonly)
Returns the value of attribute original_exception
18 19 20 |
# File 'lib/grape/dsl/rescue_options.rb', line 18 def original_exception @original_exception end |