Error handling in Mikrotik scripts
It seems that there isn't error handling in this kind of scripts. You should probably adopt the solution proposed by this guy:
So you have to have 2 scripts, one that runs and does stuff and handles situation when some value is not received as expected, and other script does the job, that can fail. as a result, if second script fails, first one that called second script to do the job will continue.
UPDATE as of RouterOS v6.2
You can now create a do
block with an error handler:
:do {
/tool fetch $url
:put "Fetch OK"
} on-error={ :put "Fetch ERROR"};