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: error classification #50

Merged
merged 8 commits into from
Jan 7, 2025
Merged

feat: error classification #50

merged 8 commits into from
Jan 7, 2025

Conversation

0xnigir1
Copy link
Collaborator

@0xnigir1 0xnigir1 commented Jan 7, 2025

🤖 Linear

Closes GIT-221

Description

We make all custom exception on the project to extend Retriable or NonRetriable base errors classes
Also, we create some new exceptions where needed

Checklist before requesting a review

  • I have conducted a self-review of my code.
  • I have conducted a QA.
  • If it is a core feature, I have included comprehensive tests.

@0xnigir1 0xnigir1 requested review from jahabeebs and 0xyaco January 7, 2025 00:56
@0xnigir1 0xnigir1 self-assigned this Jan 7, 2025
Copy link

linear bot commented Jan 7, 2025

Base automatically changed from feat/error-retry-handling to dev January 7, 2025 12:25
Copy link
Collaborator

@0xyaco 0xyaco left a comment

Choose a reason for hiding this comment

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

Great!


if (pgError instanceof Error && "code" in pgError) {
// Connection errors
if (pgError.code === "57P01" || pgError.code === "57P03") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just as a super nice to have and adding more context to this, Postgres error codes might change in future versions; they are more or less stable though so one error changing from one code to another is pretty weird (but it can happen).

I'd say that grouping these error codes in some kind of versioned error dictionary would be amazing, based on the version you used as a reference. That way, if for some reason someone ends up using PG 20 in the future for this, they only need to change the error dictionary in use.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ooo that certainly will be a next level feature but super true. will add it to the Linear to have it tracked

Copy link
Collaborator

@jahabeebs jahabeebs left a comment

Choose a reason for hiding this comment

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

Great work 🫡

@0xnigir1 0xnigir1 merged commit 042191f into dev Jan 7, 2025
6 checks passed
@0xnigir1 0xnigir1 deleted the feat/error-classification branch January 7, 2025 14:50
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.

3 participants