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
Catcherthat can be used in aTaskorParallelstate to catch errors and then redirect theStateMachineto another state to continue processing.Parameters: - ErrorNameList (list of str) – [Required] The set of error names that this
Catcherwill 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
listof error names that this instance will handle.Returns: list of str – The list of error names
-
get_next_state()¶ Returns the
StateBaseinstance that will be invoked if thisCatchertraps an errorReturns: StateBase– The next state to be invoked
-
set_error_name_list(ErrorNameList)¶ Sets the
listof error names that this instance will handle.ErrorNameListmust not beNone, and must be a non-emptylistofstr.Parameters: ErrorNameList (list of str) – [Required] The set of error names that this Catcherwill handle.
-
set_next_state(NextState=None)¶ Sets the next state to be invoked if any of the specified error conditions occur.
NextStatemust 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
Exceptionwith details of the error, if the instance is incorrectly defined.
- ErrorNameList (list of str) – [Required] The set of error names that this