Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 41810200B5A for ; Thu, 4 Aug 2016 18:00:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4003D160AAB; Thu, 4 Aug 2016 16:00:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 89927160A6A for ; Thu, 4 Aug 2016 18:00:10 +0200 (CEST) Received: (qmail 6474 invoked by uid 500); 4 Aug 2016 15:59:39 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 6463 invoked by uid 99); 4 Aug 2016 15:59:39 -0000 Received: from Unknown (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Aug 2016 15:59:39 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 7923E2C029E for ; Thu, 4 Aug 2016 15:59:20 +0000 (UTC) Date: Thu, 4 Aug 2016 15:59:20 +0000 (UTC) From: "Henri Biestro (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Comment Edited] (JEXL-210) The way to cancel script execution with an error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 04 Aug 2016 16:00:11 -0000 [ https://issues.apache.org/jira/browse/JEXL-210?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15407999#comment-15407999 ] Henri Biestro edited comment on JEXL-210 at 8/4/16 3:58 PM: ------------------------------------------------------------ If you want to protect execution from exceptions, you now can use either a method that consumes a script/lambda and catches all or even better, use an annotation that catches all and returns null. was (Author: henrib): If you want to protect execution from exceptions, you now can use an annotation that catches all and returns null. > 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)