Skip to content

Conversation

svozza
Copy link
Contributor

@svozza svozza commented Aug 11, 2025

Summary

This PR creates the error handler registry class. It follows the same pattern as the route registry by exposing register and resolve methods. A very rudimentary integration with the BaseRouter class has also been done, the next PR will fully implement that integration.

Changes

  • Created the ErrorHandlerRegistry class
  • Added errorHandler() method to BaseRouter: Allows registration of error handlers for specific error types using the ErrorHandlerRegistry
  • Integrated ErrorHandlerRegistry: BaseRouter now instantiates and manages an ErrorHandlerRegistry
  • Added unit tests: Created tests for error handler registry and the base router integration

Issue number: #4141


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@svozza svozza requested a review from dreamorosi August 11, 2025 21:31
@svozza svozza self-assigned this Aug 11, 2025
@boring-cyborg boring-cyborg bot added event-handler This item relates to the Event Handler Utility tests PRs that add or change tests labels Aug 11, 2025
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Aug 11, 2025

Not all issues are linked correctly.

Please link each issue to the PR either manually or using a closing keyword in the format fixes #<issue-number> format.

If mentioning more than one issue, separate them with commas: i.e. fixes #<issue-number-1>, closes #<issue-number-2>.

@svozza svozza force-pushed the event-handler/error-handling-rest-api branch from 180bc8e to 9dae641 Compare August 11, 2025 21:37
@dreamorosi
Copy link
Contributor

For some reason Sonar is failing but there were findings (https://sonarcloud.io/project/issues?issueStatuses=OPEN%2CCONFIRMED&sinceLeakPeriod=true&pullRequest=4307&id=aws-powertools_powertools-lambda-typescript) usually making another commit fixes it, I think we can address these items and it'll work.

@svozza svozza force-pushed the event-handler/error-handling-rest-api branch from 611beb6 to 24423ae Compare August 12, 2025 08:49
Copy link

@svozza
Copy link
Contributor Author

svozza commented Aug 12, 2025

For some reason Sonar is failing but there were findings (https://sonarcloud.io/project/issues?issueStatuses=OPEN%2CCONFIRMED&sinceLeakPeriod=true&pullRequest=4307&id=aws-powertools_powertools-lambda-typescript) usually making another commit fixes it, I think we can address these items and it'll work.

Yeah, that fixed it!

@svozza svozza requested a review from dreamorosi August 12, 2025 08:51
@svozza svozza merged commit aaac429 into main Aug 12, 2025
34 checks passed
@svozza svozza deleted the event-handler/error-handling-rest-api branch August 12, 2025 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
event-handler This item relates to the Event Handler Utility size/L PRs between 100-499 LOC tests PRs that add or change tests
Projects
Status: Working on it
Development

Successfully merging this pull request may close these issues.

2 participants