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

[Feature Request] Exception details #122

Closed
kriakiku opened this issue Aug 29, 2023 · 4 comments · Fixed by #158
Closed

[Feature Request] Exception details #122

kriakiku opened this issue Aug 29, 2023 · 4 comments · Fixed by #158

Comments

@kriakiku
Copy link

Hi! In the process of configuring CI/CD, I encountered exceptions. All network errors are not very informative:

🦋  Creating git tag...
🦋  New tag:  @***/***@0.0.5
[command]/usr/bin/git push origin --tags
To https://gitlab.com/***/***/***.git
 * [new tag]         @***/***@0.0.5 -> @***/***@0.0.5
HTTPError: Response code 403 (Forbidden)
    at Request.<anonymous> (/builds/***/***/***/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: 169332[73](https://gitlab.com/***/***/***/-/jobs/0000000000#L73)1[77](https://gitlab.com/***/***/***/-/jobs/0000000000#L77)94,
    socket: 1693327317796,
    lookup: 1693327317799,
    connect: 169332731[78](https://gitlab.com/***/***/***/-/jobs/0000000000#L78)02,
    secureConnect: 1693327317810,
    upload: 1693327317811,
    response: 169332731[80](https://gitlab.com/***/***/***/-/jobs/0000000000#L80)64,
    end: 1693327318067,
    error: undefined,
    abort: undefined,
    phases: {
      wait: 2,
      dns: 3,
      tcp: 3,
      tls: 8,
      request: 1,
      firstByte: 253,
      download: 3,
      total: 273
    }
  },
  description: '403 Forbidden'
}
error Command failed with exit code 1.

It is unclear which part of the process the problem occurred with. It would be cool to see the details about the error 👉👈

@JounQin
Copy link
Member

JounQin commented Nov 6, 2023

Well, PR welcome.

@JounQin
Copy link
Member

JounQin commented Dec 18, 2023

Related jdalrymple/gitbeaker#2600

@jdalrymple
Copy link

jdalrymple commented Dec 18, 2023

The error has a cause object connected to it. In this cause object you can access the raw Response (and request) object from fetch, including all the connected instances methods for seeing more information about the failed request.

I try to parse out the actual error messages, but sometimes they are not caught depending on the format that is returned

@JounQin
Copy link
Member

JounQin commented Dec 19, 2023

https://github.com/jdalrymple/gitbeaker/blob/52ef0e622de304d98afb811f4937560edefd8889/packages/rest/src/Requester.ts#L79-L86

@jdalrymple Thanks, the codes here make a lot of sense to me for understanding the error structure.

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

Successfully merging a pull request may close this issue.

3 participants