-
Couldn't load subscription status.
- Fork 4.3k
Description
Describe the feature
I find myself repeatedly declaring the following trivial interface:
export type ICatchable = {
addCatch(handler: sfn.IChainable, props?: sfn.CatchProps): sfn.INextable
};I think this would be useful to others if included in aws-stepfunctions/lib/types.ts alongside the existing interfaces such as IChainable and INextable.
Use Case
When writing reusable code to produce specific idioms in a step function definition, I often want to declare a parameter as taking a piece of logic that I can catch exceptions from.
Proposed Solution
By annotating the parameter as (for example) IChainable & ICatchable, the function indicates clearly that it intends to attach a catch clause to the state(s).
Other Information
An alternative is for the callee (the reusable idiom) to check for the existence of an .addCatch() method, or do other introspection on the passed-in chain, and call .toSingleState() if needed. I prefer the interface declaration, as it is "less magic" from the user's perspective, and also serves as documentation of what the idiom is planning to do.
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
AWS CDK Library version (aws-cdk-lib)
v2.217.0
AWS CDK CLI version
n/a
Environment details (OS name and version, etc.)
All