Class: AWS::Flow::Core::BeginRescueEnsureWrapper
- Defined in:
- lib/aws/flow/begin_rescue_ensure.rb
Overview
Class to ensure that all the inner guts of BRE aren’t exposed. This function is passed in when error_handler is called, like this:
error_handler do |t|
t.begin { "This is the begin" }
t.rescue(Exception) { "This is the rescue" }
t.ensure { trace << t.begin_task }
end
The t that is passed in is actually a BeginRescueEnsureWrapper, which will only pass begin/rescue/ensure onto the BeginRescueEnsure class itself.
Instance Attribute Summary collapse
-
#__context__ ⇒ Object
readonly
Also has a few methods to ensure Fiber-ness, such as get_heirs and cancel.
Instance Method Summary collapse
-
#begin(&block) ⇒ Object
Binds the block to the a lambda to be called when we get to the begin part of the DFA.
- #cancel(error_type) ⇒ Object
-
#ensure(&block) ⇒ Object
Binds the block to the a lambda to be called when we get to the ensure part of the DFA.
-
#get_closest_containing_scope ⇒ Object
Gets the parent of the BeginRescueEnsure instance held by this class.
-
#initialize(block, begin_rescue_ensure) ⇒ BeginRescueEnsureWrapper
constructor
Creates a new BeginRescueEnsureWrapper instance.
-
#rescue(error_type, &block) ⇒ Object
Binds the block to the a lambda to be called when we get to the rescue part of the DFA.
Methods inherited from FlowFiber
#[], [], []=, #[]=, finalize, unset
Constructor Details
#initialize(block, begin_rescue_ensure) ⇒ BeginRescueEnsureWrapper
Creates a new BeginRescueEnsureWrapper instance.
327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 327 def initialize(block, begin_rescue_ensure) @beginRescueEnsure = begin_rescue_ensure @__context__ = @beginRescueEnsure super() do begin block.call(self) ensure @__context__.parent.remove(self) end end end |
Instance Attribute Details
#__context__ ⇒ Object (readonly)
Also has a few methods to ensure Fiber-ness, such as get_heirs and cancel.
317 318 319 |
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 317 def __context__ @__context__ end |
Instance Method Details
#begin(&block) ⇒ Object
Binds the block to the a lambda to be called when we get to the begin part of the DFA
365 |
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 365 def begin(&block) @beginRescueEnsure.begin(block) end |
#cancel(error_type) ⇒ Object
346 347 348 |
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 346 def cancel(error_type) @beginRescueEnsure.parent.cancel(self) end |
#ensure(&block) ⇒ Object
Binds the block to the a lambda to be called when we get to the ensure part of the DFA
368 |
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 368 def ensure(&block) @beginRescueEnsure.ensure(block) end |
#get_closest_containing_scope ⇒ Object
Gets the parent of the AWS::Flow::Core::BeginRescueEnsure instance held by this class.
360 361 362 |
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 360 def get_closest_containing_scope @beginRescueEnsure.parent end |
#rescue(error_type, &block) ⇒ Object
Binds the block to the a lambda to be called when we get to the rescue part of the DFA
371 372 373 |
# File 'lib/aws/flow/begin_rescue_ensure.rb', line 371 def rescue(error_type, &block) @beginRescueEnsure.rescue(error_type, block) end |