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

Expose internal debug functionality #764

Closed
jdalrymple opened this issue May 5, 2020 · 6 comments
Closed

Expose internal debug functionality #764

jdalrymple opened this issue May 5, 2020 · 6 comments
Labels
awaiting upstream type:feature Changes add a new feature

Comments

@jdalrymple
Copy link
Owner

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!

@detj
Copy link

detj commented May 21, 2020

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

@sdc224
Copy link

sdc224 commented May 23, 2020

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
Copy link

sdc224 commented Jun 6, 2020

Any update over this @jdalrymple ?

@jdalrymple
Copy link
Owner Author

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

@jdalrymple
Copy link
Owner Author

Really should do this one 🤦

@jdalrymple
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting upstream type:feature Changes add a new feature
Projects
None yet
Development

No branches or pull requests

3 participants