Skip to content

Conversation

@soupi
Copy link
Contributor

@soupi soupi commented Jan 4, 2024

What

Currently we return 500 internal error whenever there's an error.
Some errors should return different errors such as 400 or 422.

How

See the changes to the code in crates/connectors/src/*.rs to see which error is mapped to which ndc-hub error.

We also catch specific errors from postgres now, if the code in of the 22 class we return a 422 error, if it is from the 23 class we return a 403 error (for mutations).

@soupi soupi changed the title WIP: better error codes Better error codes Jan 5, 2024
@soupi soupi marked this pull request as ready for review January 5, 2024 08:37
@soupi soupi requested review from i-am-tom and plcplc January 5, 2024 08:46
@soupi soupi enabled auto-merge January 5, 2024 09:49
Copy link
Contributor

@plcplc plcplc left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@soupi soupi added this pull request to the merge queue Jan 5, 2024
Merged via the queue into main with commit 8294e43 Jan 5, 2024
@soupi soupi deleted the gil/better-error-codes branch January 5, 2024 10:54
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