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. Recorded on the
inheritable settings via Grape::Util::InheritableSetting#add_rescue_options
(the nearest scope's latest registration wins on read, see
#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 (spec fixtures, a
middleware built by hand). 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.
20 21 22 |
# File 'lib/grape/dsl/rescue_options.rb', line 20 def initialize(backtrace: false, original_exception: false) super end |
Instance Attribute Details
#backtrace ⇒ Object (readonly)
Returns the value of attribute backtrace
19 20 21 |
# File 'lib/grape/dsl/rescue_options.rb', line 19 def backtrace @backtrace end |
#original_exception ⇒ Object (readonly)
Returns the value of attribute original_exception
19 20 21 |
# File 'lib/grape/dsl/rescue_options.rb', line 19 def original_exception @original_exception end |