How to handle http.request errors (SOLVED)

Sometimes my net connection sucks. What’s the proper way to handle errors like this?

ERROR:SCRIPT: HTTP request to 'https://i.imgur.com/j2VGVzG.png' failed (http result: -1  socket result: -5)

I guess this is only printed to the console? So I can inspect the response and decide to retry or whatever and ignore these kinds of console prints.

You can inspect the response table and check the status value. In your case when the call fails completely I believe the status would be 0 and response nil or possibly an empty string.

2 Likes