-
-
Notifications
You must be signed in to change notification settings - Fork 140
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
plv8 swallows error stack #211
Comments
it hasn't been super high priority - I will try to spend some time on it, but if anyone else wants to send a PR, I'd be happy to look at it. |
Calling: RAISE EXCEPTION USING
MESSAGE = 'A First Name is required.',
DETAIL = 'A detailed message??',
HINT = 'Do this to avoid that.',
COLUMN = 'firstName'
; Right now, the error object looks like: {
"column_name":"firstName",
"constraint_name":null,
"datatype_name":null,
"message": "A First Name is required.",
"schema_name":null,
"sqlerrcode":"P0001",
"stack": "some stack trace here...",
"table_name":null
} It would be nice to also include the following: |
Error messages are reported here: Lines 1769 to 1773 in 57db50d
|
Looking at how psycopg2 does it, they use |
PostgreSQL's I think That can be added here: Line 262 in 57db50d
|
If PostgreSQL throws an error up the stack from a
plv8.execute(...)
, the actual error stack is swallowed and hidden. When usingplpgsql
, the actual error line is reported.Here's an example to demonstrate this:
Then call
_callsanerror()
function either directly or throughplpgsql
:SELECT _callsanerror();
Outputs the message:
Outputs the message:
When called from
plv8
, the relevate stack line that actually threw the error is swallowed:Outputs the message:
No reference to
Context: PL/pgSQL function _callsanerror() line 5 at assignment
.Is there any way to make use of
PG_EXCEPTION_CONTEXT
and return the full stack?https://www.postgresql.org/docs/current/static/plpgsql-control-structures.html#PLPGSQL-EXCEPTION-DIAGNOSTICS
The text was updated successfully, but these errors were encountered: