You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Henri Biestro (JIRA)" <ji...@apache.org> on 2016/08/04 15:01:20 UTC

[jira] [Resolved] (JEXL-210) The way to cancel script execution with an error

     [ https://issues.apache.org/jira/browse/JEXL-210?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Biestro resolved JEXL-210.
--------------------------------
    Resolution: Fixed

Bulk fix for JEXL-210, JEXL-207, JEXL-197

RELEASE-NOTES.txt
src/main/java/org/apache/commons/jexl3/internal/Interpreter.java
src/main/java/org/apache/commons/jexl3/internal/InterpreterBase.java
src/site/xdoc/changes.xml
src/test/java/org/apache/commons/jexl3/AnnotationTest.java
src/test/java/org/apache/commons/jexl3/IssuesTest.java

Committed revision 1755195.

> The way to cancel script execution with an error
> ------------------------------------------------
>
>                 Key: JEXL-210
>                 URL: https://issues.apache.org/jira/browse/JEXL-210
>             Project: Commons JEXL
>          Issue Type: New Feature
>    Affects Versions: 3.0
>            Reporter: Dmitri Blinov
>            Assignee: Henri Biestro
>            Priority: Minor
>             Fix For: 3.0.1
>
>
> 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 
> {code}
>     public static class Error extends JexlException {
>     ...
> {code}
> 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 
> {code}
> raise 'Something has happended';
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)