superagent icon indicating copy to clipboard operation
superagent copied to clipboard

Cannot catch error thrown by superagent

Open StanleyWCTan opened this issue 4 years ago • 2 comments

Occasionally, superagent throws error from deep inside, however, its not catchable and cause the app to crash. So, is there a solution for catching the error? Thanks!

For example, requesting below 2 links will cause superagent to crash. target link: https://umwelthotel.at/index.php?id=78 or http://www.cargad.com/

try { let linkRes = await superagent.get(link).timeout({ response: 30000, deadline: 30000, }).set({"Accept-Encoding" : "gzip,deflate,sdch"}); if (linkRes && linkRes.text) { ..... } } catch (err) { // can not catch the error }

Maybe the abnormal localtion setting in response is the root cause:

image

image

StanleyWCTan avatar Sep 07 '21 10:09 StanleyWCTan

@StanleyWCTan I am also running into this issue after it having worked for the past several years. Did you ever resolve this?

joerybka-rand avatar Feb 09 '22 17:02 joerybka-rand

@StanleyWCTan I am also running into this issue after it having worked for the past several years. Did you ever resolve this?

No luck :( I built a daemon for monitoring the app, restart it once it crached.

StanleyWCTan avatar Feb 16 '22 08:02 StanleyWCTan