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

Improve error debuggability #154

Closed
mifi opened this issue Dec 22, 2022 · 1 comment · Fixed by #211
Closed

Improve error debuggability #154

mifi opened this issue Dec 22, 2022 · 1 comment · Fixed by #211
Assignees

Comments

@mifi
Copy link
Collaborator

mifi commented Dec 22, 2022

if i make a mistake updating a Template that in fact does not exist, i only see:

HTTPError: Response code 400 (Bad Request)
    at Request.<anonymous> (node_modules/got/dist/source/as-promise/index.js:118:42)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_NON_2XX_3XX_RESPONSE',
  timings: {
    start: 1671710227500,
    socket: 1671710227501,
    lookup: 1671710227501,
    connect: 1671710227537,
    secureConnect: 1671710227581,
    upload: 1671710227582,
    response: 1671710227789,
    end: 1671710227790,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 1,
      dns: 0,
      tcp: 36,
      tls: 44,
      request: 1,
      firstByte: 207,
      download: 1,
      total: 290
    }
  },
  transloaditErrorCode: 'TEMPLATE_VALIDATION_ERROR'
}

I don’t know why it failed.

Yet if i code node_modules/transloadit/ to manually dump the body when this happens, I can see the API does reveal more about the nature of my fail:

{
  body: {
    error: 'TEMPLATE_VALIDATION_ERROR',
    message: "Invalid id/name: A Template with id/name 'xyz' doesn't exist for this app.",
    http_code: 400
  }
}

TLDR:

Would be cool to add body.message to the error that the consuming dev sees. Also got swallows async stack traces. we might want to move off got. See #199

@lekevbot lekevbot added the sdks Integrations for Transloadit's API label Dec 22, 2022
@lekevbot lekevbot added the prio-3 label May 4, 2023
@kvz kvz removed prio-3 sdks Integrations for Transloadit's API labels Nov 18, 2024
@remcohaszing
Copy link
Member

We can leverage Error.cause to add more error context. I think this is a good practice 99% of the time regardless of this issue.

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

Successfully merging a pull request may close this issue.

4 participants