Uploaded image for project: 'Commons JEXL'
  1. Commons JEXL
  2. JEXL-210

The way to cancel script execution with an error

    Details

    • Type: New Feature
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 3.1
    • Labels:
      None

      Description

      I don't see a way now to cancel script execution with some kind of error. Unfortunately it's not possible to just throw an exception from some method as this will rely on current settings of context/engine strictness and verboseness. Using InterruptedException for this purpose is not an option because I think it has special meaning of cancelling the current thread execution. Yet the task I beleive is quite common - to inform the executing environment that the script has encountered some unavoidable situation and can not continue. Just like return statement but returning not a value but an error.

      For this purpose we can simply introduce some new type of exception, for example

          public static class Error extends JexlException {
          ...
      

      and by throwing it from any method the JexlEngine will terminate the current script execution regardless of strictness/verboseness. May be this task even deserves to have a special operator, for example

      raise 'Something has happended';
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                henrib Henri Biestro
                Reporter:
                dmitri_blinov Dmitri Blinov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: