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

Produce the original stack trace #508

Open
gajus opened this issue Sep 26, 2023 · 0 comments
Open

Produce the original stack trace #508

gajus opened this issue Sep 26, 2023 · 0 comments

Comments

@gajus
Copy link
Owner

gajus commented Sep 26, 2023

Current Behavior

    at executeQuery (/Users/gajus/Developer/gajus/slonik/src/routines/executeQuery.ts:127:11)
    at query (/Users/gajus/Developer/gajus/slonik/src/connectionMethods/query.ts:17:28)
    at any (/Users/gajus/Developer/gajus/slonik/src/connectionMethods/any.ts:17:31)
    at Object.any (/Users/gajus/Developer/gajus/slonik/src/binders/bindPoolConnection.ts:27:17)
    at /Users/gajus/Developer/gajus/slonik/src/binders/bindPool.ts:24:40
    at createConnection (/Users/gajus/Developer/gajus/slonik/src/factories/createConnection.ts:169:20)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.any (/Users/gajus/Developer/gajus/slonik/src/binders/bindPool.ts:18:14)

Desired Behavior

    at createPool (src/factories/createPool.ts:57:9)
    at test/helpers/createIntegrationTests.ts:54:35

Motivation

It would make it a lot easier to debug captured errors.

Implementation

The TLDR of why this is happening is because we have async steps between the query invocation location and query execution, e.g.

  1. connecting to the database
  2. await for type overrides
  3. interceptors

The fix would require that we capture the stack trace at the earliest possible and then override error stack trace before re-throwing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant