gitbeaker icon indicating copy to clipboard operation
gitbeaker copied to clipboard

Expose internal debug functionality

Open jdalrymple opened this issue 5 years ago • 5 comments

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!

jdalrymple avatar May 05 '20 15:05 jdalrymple

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

detj avatar May 21 '20 12:05 detj

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

sdc224 avatar May 23 '20 04:05 sdc224

Any update over this @jdalrymple ?

sdc224 avatar Jun 06 '20 10:06 sdc224

Not yet, focusing on fixing up the things already in the PR stage

jdalrymple avatar Jun 06 '20 11:06 jdalrymple

Really should do this one :facepalm:

jdalrymple avatar Mar 27 '21 23:03 jdalrymple

Exposing the response in the Error's cause property in #2258

jdalrymple avatar Mar 22 '23 04:03 jdalrymple