commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Biestro (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (JEXL-210) The way to cancel script execution with an error
Date Wed, 03 Aug 2016 16:38:20 GMT

    [ https://issues.apache.org/jira/browse/JEXL-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15406138#comment-15406138
] 

Henri Biestro edited comment on JEXL-210 at 8/3/16 4:37 PM:
------------------------------------------------------------


Should the engine make a clearer difference between an error (property, method, etc) and an
exception ? If we state that 'strict' is only about what is considered an error (var, property,
method resolution failing) and 'silent' about whether errors throw (Jexl)Exceptions or not,
a strict=false but silent=true should allow exceptions raised from user methods to terminate
script execution throwing a JexlException  whose cause is that user exception.


was (Author: henrib):
I dont understand; isn't the current behavior the logical outcome of JEXL-207 ? If you want
the script to stop on error, set the engine as strict & !silent.
You want the engine to make a difference between an error (property, method, etc) and an exception
?

> 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
>
> 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)

Mime
View raw message