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

Error object not yet documented #17

Open
triqi opened this issue May 30, 2019 · 0 comments
Open

Error object not yet documented #17

triqi opened this issue May 30, 2019 · 0 comments

Comments

@triqi
Copy link

triqi commented May 30, 2019

When handling errors, e.g. try {... } catch (error) { ... }, I couldn't find a definitive source of the definition of the error object. What I've done is log out the error object and added it below with my own interpretation of the object fields and what each of them means. Happy to submit a PR to update the README docs.

{
  // The error type, possible values are RequestError, StatusCodeError, TransformError
  "name": "StatusCodeError",
  // A formatted string
  "message": "{statusCode} - JSON.stringify(response.body)",
  // The full stack trace captured a the point the error is generated
  "stack": "Full stack trace",
  // The HTTP status code
  "statusCode": 404,
  // The response body (legacy?)
  "error": "",
  // The option object pass into the request
  "options": {},
  // The response object
  "response": {}
}
{
    // The error type, possible values are RequestError, StatusCodeError, TransformError
    "name": "RequestError",
    // The stringify value of the upstream error object
    "message": "cause",
    // The upstream error object
    "cause": "cause",
    // The same as the cause value (legacy?)
    "error": "cause",
    // The option object pass into the request
    "options": {},
    // The response object
    "response": {}
}
{
    // The error type, possible values are RequestError, StatusCodeError, TransformError
    "name": "TransformError",
    // The stringify value of the upstream error object
    "message": "cause",
    // The upstream error object
    "cause": "cause",
    // The same as the cause value (legacy?)
    "error": "cause",
    // The option object pass into the request
    "options": {},
    // The response object
    "response": {}
}
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

No branches or pull requests

1 participant