MystPi
`Request` body reading functions: possible error types
This has a section saying:
⚠️ Be aware that the req.text() call can fail if the user hangs up the connection before the body is fully received. Make sure to handle this case. Do note this can happen in all methods that read from the request body, such as req.json(), req.formData(), req.arrayBuffer(), req.body.getReader().read(), req.body.pipeTo(), etc.I was wondering exactly which error gets thrown in this situation. Is it a NetworkError, or a TypeError, etc. I couldn't find any documentation (even in the spec) regarding what errors these body reading functions can throw. I have a use case that requires knowing exactly why the function failed. Thanks in advance!
5 replies