pglite icon indicating copy to clipboard operation
pglite copied to clipboard

Expose useLiveQuery SQL error

Open edishu opened this issue 1 year ago • 1 comments

I'm building a SQL editor using pglite and react-pglite. While a user is editing query there can be syntax errors in the query. The useLiveQuery hook in that case throws an error like:

Uncaught (in promise) error: syntax error at or near "table"
sql-console-error

But there is no way to obtain this SQL error from useLiveQuery. If I have access to the error I can expose it in the UI so that user can correct their query.

edishu avatar Apr 14 '25 18:04 edishu

Thanks for reporting this. I opened #1091 to expose useLiveQuery initialization errors through an optional onError callback.

This change touches the same useLiveQuery options and overload plumbing being introduced in #1080, so I implemented it on top of that work to keep the API consistent and avoid conflicting changes.

#1091 currently targets main because #1080's head branch exists only in my fork. Once #1080 is merged, I'll rebuild the branch on the latest main so the PR contains only the error-handling change.

psh4607 avatar Aug 19 '26 05:08 psh4607