This seems to only work when the fetch result is successful.
If we try another example with a wrong URL (correct = reqbin.com), the result is only the error, not the failed status.
So, inside a script, it would be nice to treat the error with a friendlier message.
When a fetch fails, how can I capture the status and error message?
If we try another example with a wrong URL (correct = reqbin.com), the result is only the error, not the failed status.
Code:
{ :local result [/tool fetch url=https://reqb.com/echo/get/json output=user as-value] :if ($result->"status" = "failed") do={ :put ($result->"status") # Empty status } }
When a fetch fails, how can I capture the status and error message?
Statistics: Posted by diasdm — Sun Mar 24, 2024 4:11 am