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

refactor: centralize error messages #19

Merged
merged 1 commit into from
Apr 28, 2024

Conversation

steve-chavez
Copy link
Member

Problem

Error messages are scattered everywhere. This hurts maintainability.

Solution

Centralize error messages into a single module.

I've used the same technique done in PostgREST: an observation type plus a callback that acts upon it.

Notes

I also tried to make the functions pure (and return an error type) but this is more cumbersome because some of extra parameters would need to be allocated to be passed.

At least non-pure functions now have a "marker" (explicit observation handler as a parameter).

@steve-chavez steve-chavez merged commit 97ec311 into PostgREST:master Apr 28, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant