MONITOR is a way to perform any set of instructions and then catch any eventual errors.
Useful when you know there is a risk of an error and you don’t want to blow up the program in the users face.

It’s a way of performing a “try-catch” sequence. Try something and if it didn’t work, catch the error and do something else.

It consists of 3 main elements:

  1. monitor – States the beginning of the monitor group.
  2. on-error – States that you catch any errors and allows you to write code to be run in the event of an error.
  3. endmon – States the end of the monitor scope.