Catcher¶
The Catcher
class defines how to continue processing when a failure occurs in a Task
or Parallel
execution.
For more details on Catcher
, see the AWS documentation.
-
class
awssl.
Catcher
(ErrorNameList=None, NextState=None)¶ Models a
Catcher
that can be used in aTask
orParallel
state to catch errors and then redirect theStateMachine
to another state to continue processing.Parameters: - ErrorNameList (list of str) – [Required] The set of error names that this
Catcher
will handle. - NextState (instance of class derived from
StateBase
) – [Required] Next state to be invoked within this branch.
-
clone
(NameFormatString='{}')¶ Returns a clone of this instance.
If the next state invoked by this catcher is not an end state, then the next state will also be cloned, to establish a complete clone of the branch form this instance onwards.
Parameters: NameFormatString (str) – [Required] The naming template to be applied to generate the name of next state in the new instance. Returns: Catcher
– A new instance of this instance and any other instances in its branch.
-
get_error_name_list
()¶ Returns the
list
of error names that this instance will handle.Returns: list of str – The list of error names
-
get_next_state
()¶ Returns the
StateBase
instance that will be invoked if thisCatcher
traps an errorReturns: StateBase
– The next state to be invoked
-
set_error_name_list
(ErrorNameList)¶ Sets the
list
of error names that this instance will handle.ErrorNameList
must not beNone
, and must be a non-emptylist
ofstr
.Parameters: ErrorNameList (list of str) – [Required] The set of error names that this Catcher
will handle.
-
set_next_state
(NextState=None)¶ Sets the next state to be invoked if any of the specified error conditions occur.
NextState
must not beNone
.Parameters: NextState (instance of class derived from StateBase
) – [Required] Next state to be invoked within this branch.
-
to_json
()¶ Returns the JSON representation of this instance.
Returns: dict – The JSON representation
-
validate
()¶ Validates this instance is correctly specified.
Raises
Exception
with details of the error, if the instance is incorrectly defined.
- ErrorNameList (list of str) – [Required] The set of error names that this