if_error,<command>,<error_action> is a useful command, which sets an error action <error_action> for instances of <command> following if_error instance.

<error_action> could be the following:
  1. continue - ignore any possible error and continue running the script
  2. ignore - the same as continue
  3. abort - abort running the script after the command which caused an error
  4. halt - seems to be the same as abort


I think if_error is very useful sometimes, for example, when one makes a region backup before erasing the region. Saving the backup could fail, but erasing the region won't

For example, let's consider the following update.txt script:
Code:
Please Login or Register to see the links
When it's run the following update.log is produced:
Code:
Please Login or Register to see the links
Region number 1 doesn't exist, so all instances of rrgn,1, should have caused an error. But because of if_error,rrgn,ignore the first two completed successfully. And then because of if_error,rrgn,halt the third one aborted the script.
Note that if a script is aborted, last_id.bin is not saved, even if write_last_id,1 is present. Therefore, the script would run many times if used on the same device.