How to catch rule exception

You have to add try/catch/finally to your rules or add error checking to prevent the exception from being thrown in the first place.

The entire purpose of exceptions is to stop everything and back out of the programming stack until you find a catch that handles that exception. The only way to prevent that is to prevent the exception in the first place or provide your own catch.

then
   try {
      // do some stuff
   }
   catch(Throwable t) {
      logError("Error", "Some bad stuff happened in my rule: " + T.toString)
   }
   finally {
      // always runs even if there was an error, good place for cleanup
   }
7 Likes