How can I catch and handle a RequestError? #2321
-
I am using got 12. Currently the server I request data from returns me incorrect headers. This causes my nodejs app to crash. I would like to catch the error so instead of crashing my app will inform the user that there's a problem. But whatever I try, I cannot catch the error, it doesn't seem to reach my own code before crashing. This is the stacktrace I see: I put try/catch everywhere I can including directly around the got request: Any ideas/help? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You are missing an |
Beta Was this translation helpful? Give feedback.
You are missing an
await
before thegot()
call.