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(postgrest): Add toJson() method to PostgrestException to allow serialization #783

Merged
merged 1 commit into from Jan 3, 2024

Conversation

borgoat
Copy link
Contributor

@borgoat borgoat commented Jan 2, 2024

What kind of change does this PR introduce?

Make PostgrestException serialisable by implementing the toJson method.

What is the current behavior?

I was having some issues due to PostgrestException, since I keep track of errors in the Redux store, and persist it. TBH, I was thinking I do not really want to store an exception as is or display it to the user directly, but I would like not to lose the information, maybe embed it in a user-friendly error, but keep the option to send it to the backend (e.g. via Sentry). So serialisation would be nice to have!

Converting object to an encodable object failed: Instance of 'PostgrestException'

What is the new behavior?

It just implements the toJson. I feel this didn't really need a test, but I can add serialisation/deserialisation roundtrip if you like ✌️

Thanks!

@dshukertjr dshukertjr changed the title feat(postgrest): toJson method to allow serialization feat(postgrest): Add toJson() method to PostgrestException to allow serialization Jan 3, 2024
Copy link
Member

@dshukertjr dshukertjr left a comment

Choose a reason for hiding this comment

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

Thank you so much for this contribution!

@dshukertjr dshukertjr merged commit 28c9819 into supabase:main Jan 3, 2024
8 checks passed
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.

None yet

2 participants