Skip to content

Interpret some types of Postgres errors to be user facing#76

Merged
brandur merged 1 commit intomasterfrom
brandur-interpret-postgres-errors
Jun 29, 2024
Merged

Interpret some types of Postgres errors to be user facing#76
brandur merged 1 commit intomasterfrom
brandur-interpret-postgres-errors

Conversation

@brandur
Copy link
Collaborator

@brandur brandur commented Jun 28, 2024

A partial fix for #73. Instead of always returning an internal error on
problems like insufficient privileges, instead return a user-facing API
error with a description of what's wrong.

This is only a partial fix because it requires the new API
infrastructure from #71 to work properly, so we'll need to convert the
rest of the endpoints over for it to be fully effective.

One possibility is that we might want to just take any kind of
*pgconn.PgError and change that to a user-facing error. I didn't do
that here, but it strikes me as fairly plausible. I figure we should
maybe wait for one more type of error that's commonly encountered before
taking this step.

@brandur brandur force-pushed the brandur-interpret-postgres-errors branch 2 times, most recently from a18333c to c53cd3d Compare June 28, 2024 05:59
A partial fix for #73. Instead of always returning an internal error on
problems like insufficient privileges, instead return a user-facing API
error with a description of what's wrong.

This is only a partial fix because it requires the new API
infrastructure from #71 to work properly, so we'll need to convert the
rest of the endpoints over for it to be fully effective.

One possibility is that we might want to just take any kind of
`*pgconn.PgError` and change that to a user-facing error. I didn't do
that here, but it strikes me as fairly plausible. I figure we should
maybe wait for one more type of error that's commonly encountered before
taking this step.
@brandur brandur force-pushed the brandur-interpret-postgres-errors branch from c53cd3d to 3520806 Compare June 28, 2024 06:08
@brandur brandur requested a review from bgentry June 28, 2024 06:14
@brandur
Copy link
Collaborator Author

brandur commented Jun 29, 2024

Great, thx.

@brandur brandur merged commit d5f53c7 into master Jun 29, 2024
@brandur brandur deleted the brandur-interpret-postgres-errors branch June 29, 2024 15:17
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