How do I access the response body from an error? #1991
-
I am calling an API that can responds with HTTP code 409 and a response body as below.
I tried calling this api using got as below.
But the logs doesn't show the body. Is it possible to catch it?
|
Beta Was this translation helpful? Give feedback.
Answered by
sindresorhus
Feb 26, 2022
Replies: 1 comment
-
The |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sindresorhus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The
response
, meaning also thebody
, is attached to the error. It's all in the docs. The response is not visible when logging for practical reasons (the object is huge) and security reasons.