Skip to content

feat: creating error class#67

Merged
Joel-leal merged 13 commits intomainfrom
joel/class-error-handling
Oct 23, 2024
Merged

feat: creating error class#67
Joel-leal merged 13 commits intomainfrom
joel/class-error-handling

Conversation

@Joel-leal
Copy link
Copy Markdown
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

@vercel
Copy link
Copy Markdown

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

Comment thread src/packages/DAO/elections.dao.ts Outdated
Comment thread src/packages/utils/error.ts Outdated
Comment thread src/packages/dto/elections.dto.ts Outdated
@frattezi
Copy link
Copy Markdown
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 🙏🏼

Comment thread src/packages/DAO/elections.dao.ts Outdated
if (!parsedData.success) {
throw new BadRequestError(parsedData.error.name);
}
const electionExist = await findByNameOrStatus(parsedData.data); // Error duplicate data
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

here 7a991c7

Comment thread src/packages/dto/validateOptionsSchema.dto.ts Outdated
Comment thread src/packages/DAO/elections.dao.ts Outdated
Comment thread src/packages/DAO/elections.dao.ts Outdated
Comment thread src/app/elections/route.ts Outdated
@Joel-leal Joel-leal requested a review from frattezi October 22, 2024 15:35
Comment thread src/packages/DAO/elections.dao.ts Outdated
Comment thread src/packages/DAO/elections.dao.ts
Comment thread src/packages/dto/elections.dto.ts Outdated
Comment thread src/packages/DAO/elections.dao.ts Outdated
Comment thread src/packages/DAO/elections.dao.ts
Comment thread src/packages/DAO/elections.dao.ts
Comment thread src/packages/DAO/elections.dao.ts
Copy link
Copy Markdown

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