Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CHE-169] Add Express Async Errors Dep #131

Conversation

seantokuzo
Copy link
Contributor

Description

As part of the CHE-167 BE Refactor Error Handling story, this PR

  • adds the express-async-errors package
  • Implements it by importing in index.ts

This package wraps the entire express application so in the case of asynchronous methods (middlewares and controllers), instead of manually calling next passing in an error, we can just throw an error and it will automatically be caught and passed to the next function, invoking the global error handler.

express-async-errors npm package

Because of the added dependency, a Docker image rebuild will be required once story branch is merged into dev
Future testing on this story branch will require this updated image OR a local image build

Jira Task

JIRA TICKET

Testing Instructions

N/A - testing unavailable until future tickets making use of this new functionality

Checklist

All Team Members

  • I added a descriptive title to this PR.
  • I filled out the Description, Jira Task, and Testing Instructions sections above.
  • I added or updated [Jest unit tests]for any changes to components, server-side controllers, etc.
  • I ran npm run docker-test in my local environment to check that this PR passes all unit tests.
  • I did a quick check to make sure my code changes follow the recomended style guide.

Copy link
Contributor

@brok3turtl3 brok3turtl3 left a comment

Choose a reason for hiding this comment

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

@seantokuzo I love this new approach to error handling. I think it will work really well as we continue to scale out and I am eager to see it put into use. Great work! 🎉

server/errors/customError.ts Show resolved Hide resolved
server/index.ts Outdated Show resolved Hide resolved
@brok3turtl3
Copy link
Contributor

@seantokuzo I think you can go ahead and delete the PR for CHE-168 as all that code has been merged into this branch by the looks of it.

@brok3turtl3 brok3turtl3 merged commit 08628cd into CHE-167/story/BE-Refactor-Error-Handling Jun 8, 2024
1 check passed
@brok3turtl3 brok3turtl3 deleted the CHE-169/subtask/Add-Express-Async-Errors-Dep branch June 8, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants