Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

feat(types): Add postgres error constants enum - #302

Merged
Zeko369 merged 2 commits into
freeCodeCamp:masterfrom
robertt:feat/pg-codes
Dec 16, 2019
Merged

feat(types): Add postgres error constants enum#302
Zeko369 merged 2 commits into
freeCodeCamp:masterfrom
robertt:feat/pg-codes

Conversation

@robertt

@roberttrobertt commented Dec 16, 2019

Copy link
Copy Markdown
Contributor
  • I have read Chapter's contributing guidelines.
  • My pull request has a descriptive title (not a vague title like Update README.md).
  • My pull request targets the master branch of Chapter.

Made a new enum based on a conversation in #299. Now, instead of doing if(e.code === '23503'), you can do if(e.code === PostgresErrorCodes.FOREIGN_KEY_VIOLATION) (imo, much cleaner.)

In #299, a library was suggested, but I felt like adding an extra dep was a bad idea when the implementation was very simple.

@Zeko369

Copy link
Copy Markdown
Contributor

YES

@Zeko369
Zeko369 merged commit e8afc69 into freeCodeCamp:masterDec 16, 2019
@roberttrobertt mentioned this pull request Dec 16, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@robertt@Zeko369