Skip to content

Conversation

@svozza
Copy link
Contributor

@svozza svozza commented Aug 13, 2025

Summary

This PR adds error handling logic to the BaaseRouter class

Changes

BaseRouter

  • Added specific methods to register NotFound and MethodNotAllowed handlers
  • Added error handler methods, these take an error and check the registry to see if there is a registered handler. If not it has a fallback to a default error handler that will return a 500 error
  • Unit tests that test the error registry logic is handled correctly

Issue number: #4141

Final part of the error handling piece is to add support for decorators. I have left that till last because I wanted the logic to be easily reviewable before we added the method overloads and bolierplate to support them.


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 added this to the Event Handler Beta (priority) milestone Aug 13, 2025
@svozza svozza self-assigned this Aug 13, 2025
@pull-request-size pull-request-size bot added the size/L PRs between 100-499 LOC label Aug 13, 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 13, 2025
@powertools-for-aws-oss-automation

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>.

Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

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

Thanks for this PR - left a few comments

@svozza svozza requested a review from dreamorosi August 13, 2025 09:05
@sonarqubecloud
Copy link

@svozza svozza merged commit 5aff398 into main Aug 13, 2025
35 checks passed
@svozza svozza deleted the event-handler/error-handling-rest-api branch August 13, 2025 11:13
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 skip-changelog tests PRs that add or change tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants