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

feat: creating error class #67

Merged
merged 13 commits into from
Oct 23, 2024
Merged

feat: creating error class #67

merged 13 commits into from
Oct 23, 2024

Conversation

Joel-leal
Copy link
Contributor

@Joel-leal Joel-leal commented Sep 18, 2024

Description

Handling errors in the back-end is essential to ensure system stability, provide clear responses to users, prevent sensitive information leaks, and facilitate the identification and resolution of issues during development and maintenance.

Changes

(list of the changes been made)

  • Component Class Error
  • error implementation

Notes

(leave here a few notes that could be useful to the reviewers)

  • I created an Error component for error handling in the backend

  • I did some error handling implementations using the errors component. With the change in architecture I did not change the routes file but rather the elections.dao file

Board issue

Copy link

vercel bot commented Sep 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
voting-system ⬜️ Ignored (Inspect) Oct 23, 2024 2:27pm

@frattezi
Copy link
Contributor

@Joel-leal you got conflicting files here when compared to main
Screenshot 2024-10-22 at 09 48 10

Please solve it by doing the following:

In this branch, run git pull -r origin main this will add main newer files into your branch
Git will try then to re-write your commits, and will probably ask you to solve the conflict above
after solving it, git add . to stage files and git rebase --continue, until the rebase is done.

Finally, push force to your branch. Let me know if you need any help 🙏🏼

if (!parsedData.success) {
throw new BadRequestError(parsedData.error.name);
}
const electionExist = await findByNameOrStatus(parsedData.data); // Error duplicate data
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add to your PR samples on how the error messages are looking in case of a failed parse please?
Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't understand what you meant by this. I modified the error message so that the BadRequestError has its own message instead of just relying on the error message from Zod. Could you provide more context about what you're asking?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

here 7a991c7

src/packages/DAO/elections.dao.ts Outdated Show resolved Hide resolved
src/packages/DAO/elections.dao.ts Outdated Show resolved Hide resolved
src/app/elections/route.ts Outdated Show resolved Hide resolved
@Joel-leal Joel-leal requested a review from frattezi October 22, 2024 15:35
src/packages/DAO/elections.dao.ts Outdated Show resolved Hide resolved
src/packages/DAO/elections.dao.ts Show resolved Hide resolved
src/packages/DAO/elections.dao.ts Outdated Show resolved Hide resolved
src/packages/DAO/elections.dao.ts Show resolved Hide resolved
src/packages/DAO/elections.dao.ts Outdated Show resolved Hide resolved
src/packages/DAO/elections.dao.ts Outdated Show resolved Hide resolved
Copy link

@marco-souza marco-souza left a comment

Choose a reason for hiding this comment

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

Nice and clean! 🚢

@Joel-leal Joel-leal marked this pull request as ready for review October 23, 2024 14:42
@Joel-leal Joel-leal merged commit a3f82f3 into main Oct 23, 2024
4 checks passed
@Joel-leal Joel-leal deleted the joel/class-error-handling branch October 23, 2024 14:46
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.

Create an error boundary for the App
4 participants