gitbeaker
gitbeaker copied to clipboard
Expose internal debug functionality
Description Not sure what the best way to do this would be, but having a way to view some of the internal process would be very useful in debugging. passing a debug property that had things like the raw requests and more.
Proposal Open to ideas here!
This is specially useful for the CLI.
A --verbose global argument that shows basic information about the underlying request like
- request host
- request path
- response status code
Present error information is not too useful for the end CLI user.
â ´ Calling GitlabHTTPError: Response code 404 (Not Found)
at onResponse (/Users/xxxxx/n/lib/node_modules/@gitbeaker/cli/node_modules/got/dist/source/as-promise/index.js:124:28)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
name: 'HTTPError',
code: undefined,
timings: {
start: 1590065135378,
socket: 1590065135380,
lookup: 1590065135429,
connect: 1590065135543,
secureConnect: 1590065135661,
upload: 1590065135661,
response: 1590065135812,
end: 1590065135817,
error: undefined,
abort: undefined,
phases: {
wait: 2,
dns: 49,
tcp: 114,
tls: 118,
request: 0,
firstByte: 151,
download: 5,
total: 439
}
},
description: undefined
}
✖ Calling Gitlab
Its Something like the Fetch API doesn't throws error on other error codes except network failure.
Something like below might help you, if you are using Fetch API.
const response: Response = await fetch(hostname);
console.log(response.status); // Note: This status actually contains the error codes
// like 401,403 as well
I can create a PR if you want, I think it can be solved by using this response.status flag
Any update over this @jdalrymple ?
Not yet, focusing on fixing up the things already in the PR stage
Really should do this one :facepalm:
Exposing the response in the Error's cause property in #2258