001package com.randomnoun.common.jessop;
002
003/* (c) 2016 randomnoun. All Rights Reserved. This work is licensed under a
004 * BSD Simplified License. ( http://www.randomnoun.com/bsd-simplified.html ) 
005 */
006
007import javax.script.ScriptContext;
008import javax.script.ScriptException;
009
010/** The only reason this thing exists is because the 'bsh' and 'luaj' script engines 
011 * don't throw ScriptExceptions properly
012 *  
013 * @author knoxg
014 */
015public interface JessopExceptionConverter {
016
017        /** Convert runtime exceptions generated by this language's ScriptEngine into ScriptExceptions.
018         * 
019         * <p>(Most languages do this properly already, except for lua).
020         * 
021         * <p>This is called at runtime, not target script generation time, and should be 
022         * associated with the target source engine (e.g. rhino), not the target language (e.g. javascript).
023         */
024        ScriptException toScriptException(ScriptContext scriptContext, Throwable t);
025
026}