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

Reporting original execution context #20

Open
olivierlacan opened this issue Nov 2, 2020 · 0 comments
Open

Reporting original execution context #20

olivierlacan opened this issue Nov 2, 2020 · 0 comments

Comments

@olivierlacan
Copy link

olivierlacan commented Nov 2, 2020

I'm not quite sure whether this library is the right place to surface this information but I find myself a bit baffled at a UniqueViolationError it throws with no context regarding which of my application code might be responsible since it only preserves stack frames from db-errors and objection and not my original call site.

Example:

  1) ProjectTaskDVSV1Publisher
       "before each" hook for "builds a message that matches the schema":
     UniqueViolationError: insert into "requirements" ("created_at", "description", "id", "name", "updated_at") values ($1, $2, $3, $4, $5) returning * - duplicate key value violates unique constraint "requirements_pkey"
      at wrapError (node_modules/db-errors/lib/dbErrors.js:19:14)
      at handleExecuteError (node_modules/objection/lib/queryBuilder/QueryBuilder.js:1494:32)
      at QueryBuilder.execute (node_modules/objection/lib/queryBuilder/QueryBuilder.js:685:13)
      at processTicksAndRejections (internal/process/task_queues.js:97:5)

I'd be much more actionable if the call site that caused the exception could be included in the stacktrace or at least referenced in the error itself in some way (as a property perhaps). This may be entirely beyond the scope of this project, but I had to ask.

So for instance, given the following call site:

requirement = await Requirement.query()
      .insert({
        ...requirementAttrs
      })
      .returning('*');

I would expect the UniqueViolationError to lead me to this code somehow.

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

No branches or pull requests

1 participant