electric-sql / electric-sql/pglite

Feature Request: Better Error Handling Support

Open
#333 0 comments 17 reactions 1 assignee Claimed by @tdrz View on GitHub
Dominant language
TypeScript
Stars
16k
Forks
442
Avg merge
20h 19m
Merged PRs (30d)
7

Description

I'd like it to be a bit easier to handle errors thrown by pglite. Currently the [DatabaseError](https://github.com/electric-sql/pglite/blob/main/packages/pg-protocol/src/messages.ts#L147) class isn't exported and is bundled into the final library. The constructor name is obfuscated as well. So I can't reliably check if a thrown error is a `instanceof DatabaseError` or `error.constructor.name == "DatabaseError"`. I can check for the existence of certain fields on the error object, but I'd rather be able to use one of the previous methods.

I'd also really like the `DatabaseError` Typescript type to be exported by the library so that I can pull all of the properties off of the object in a typesafe way without using casting to my own user-land types.

Really enjoying Pglite though! Keep up the good work!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.