Skip to content

Conversation

@jasdeepbhalla
Copy link
Contributor

@jasdeepbhalla jasdeepbhalla commented Oct 22, 2025

Issue #35608

Closes #35608

Reason for this change

The Step Functions module currently lacks a type-safe way to represent states that support error handling via .addCatch().
When building reusable Step Function constructs or patterns, developers often need to specify that a state supports catching errors — similar to how INextable and IChainable express chaining behavior.

Adding an ICatchable interface improves type safety, clarity, and discoverability for these use cases.

Description of changes

  • Added a new ICatchable interface to aws-stepfunctions/lib/types.ts.

  • Defined the interface as:

    export interface ICatchable {
      addCatch(handler: IChainable, props?: CatchProps): INextable;
    }
    
  • No breaking changes — this is a purely additive enhancement.

  • Enables reusable constructs to define parameters as IChainable & ICatchable for stronger type guarantees.

Describe any new or updated permissions being added

N/A – No new IAM permissions are introduced by this change.

Description of how you validated changes

  • Verified compilation and lint checks.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team October 22, 2025 07:02
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Oct 22, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@jasdeepbhalla jasdeepbhalla changed the title (aws-stepfunctions): Include an ICatchable interface for step function states feat(aws-stepfunctions): Added an ICatchable interface for step function states Oct 22, 2025
@jasdeepbhalla jasdeepbhalla changed the title feat(aws-stepfunctions): Added an ICatchable interface for step function states feat(aws-stepfunctions): added an ICatchable interface for step function states Oct 22, 2025
@jasdeepbhalla jasdeepbhalla changed the title feat(aws-stepfunctions): added an ICatchable interface for step function states feat(stepfunctions): added an ICatchable interface for step function states Oct 22, 2025
@wimlewis-amazon
Copy link
Contributor

This looks good to me.

We could consider declaring some of the actual catchable classes as implementing ICatchable, to make it explicit that the signatures match. The INextable interface does that (e.g., class DistributedMap extends MapBase implements INextable etc.).

@jasdeepbhalla
Copy link
Contributor Author

Make sense will update the code, Thanks :)

@jasdeepbhalla jasdeepbhalla force-pushed the issue_35608_ICatchable_interface_for_stepfunctions branch from 3efcc7b to 42bc4d0 Compare October 22, 2025 22:48
@jasdeepbhalla jasdeepbhalla changed the title feat(stepfunctions): added an ICatchable interface for step function states chore(stepfunctions): added an ICatchable interface for step function states Oct 22, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review October 22, 2025 22:56

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@jasdeepbhalla
Copy link
Contributor Author

@wimlewis-amazon Can you review the changes? Do they looks good?

@jasdeepbhalla
Copy link
Contributor Author

@wimlewis-amazon @pahud This PR is ready for review!

@wimlewis-amazon
Copy link
Contributor

These changes look good to me! (The re-typing to this is a nice improvement as well IMHO).

(I'm not associated with the CDK project, so I can't officially approve the PR, but 👍 anyway)

@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

1 similar comment
@aws-cdk-automation
Copy link
Collaborator

This PR cannot be merged because it has conflicts. Please resolve them. The PR will be considered stale and closed if it remains in an unmergeable state.

@jasdeepbhalla jasdeepbhalla force-pushed the issue_35608_ICatchable_interface_for_stepfunctions branch from b516554 to 5ec3db1 Compare February 7, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-stepfunctions): Include an ICatchable interface for step function states

4 participants