[solved] Handling errors from requests

is there a way to handle errors from requests?

specifically, i am using request.loadJSON() to load data from my home server but if my server or internet is down it hits the Cloudflare error page. this cant be loaded as a json so the request errors out with Error: The data couldn’t be read because it isn’t in the correct format.. as such it never returns to the ios shortcut and i get no indication of an error. is there a way to handle this cleanly so i can return an error to the shortcut and do a proper notification about it?

NVM, i keep forgetting this is mostly just standard javascript so a standard JS try/catch works fine

1 Like