Package org.mozilla.javascript

Examples of org.mozilla.javascript.EvaluatorException


                    }

                    thrScope.setLock(true);
                    ScriptRuntime.call(context, fun, thrScope, funArgs, thrScope);
                } catch (JavaScriptException ex) {
                    EvaluatorException ee = Context.reportRuntimeError(
                                                                       ToolErrorReporter.getMessage("msg.uncaughtJSException",
                                                                                                    ex.getMessage()));
                    Throwable unwrapped = unwrap(ex);
                    if (unwrapped instanceof ProcessingException) {
                        throw (ProcessingException) unwrapped;
                    }
                    throw new CascadingRuntimeException(ee.getMessage(),
                                                        unwrapped);
                } catch (EcmaError ee) {
                    String msg = ToolErrorReporter.getMessage("msg.uncaughtJSException", ee.toString());
                    if (ee.getSourceName() != null) {
                        Context.reportRuntimeError(msg, ee.getSourceName(),
                                                   ee.getLineNumber(), ee.getLineSource(),
                                                   ee.getColumnNumber());
                    } else {
                        Context.reportRuntimeError(msg);
                    }
                    throw new CascadingRuntimeException(ee.getMessage(), ee);
                }
            } finally {
                thrScope.setLock(false);
                setSessionScope(thrScope);
                if (cocoon != null) {
View Full Code Here


                Object[] args = new Object[] {k, fom_wk};
                try {
                    ScriptableObject.callMethod(cocoon,
                                                "handleContinuation", args);
                } catch (JavaScriptException ex) {
                    EvaluatorException ee = Context.reportRuntimeError(
                                                                       ToolErrorReporter.getMessage("msg.uncaughtJSException",
                                                                                                    ex.getMessage()));
                    Throwable unwrapped = unwrap(ex);
                    if (unwrapped instanceof ProcessingException) {
                        throw (ProcessingException)unwrapped;
                    }
                    throw new CascadingRuntimeException(ee.getMessage(),
                                                        unwrapped);
                } catch (EcmaError ee) {
                    String msg = ToolErrorReporter.getMessage("msg.uncaughtJSException", ee.toString());
                    if (ee.getSourceName() != null) {
                        Context.reportRuntimeError(msg, ee.getSourceName(),
                                                   ee.getLineNumber(), ee.getLineSource(),
                                                   ee.getColumnNumber());
                    } else {
                        Context.reportRuntimeError(msg);
                    }
                    throw new CascadingRuntimeException(ee.getMessage(), ee);
                }
            } finally {
                kScope.setLock(false);
                setSessionScope(kScope);
                if (cocoon != null) {
View Full Code Here

  }

  public EvaluatorException runtimeError(String message, String sourceName,
      int line, String lineSource, int lineOffset) {
    errors_.add(composeError("RUNTIME", message, line, lineOffset));
    return new EvaluatorException(message);
  }
View Full Code Here

        chainedReporters.add(new ToolErrorReporter(true, System.err));
    }

    @Override
    public void error(String message, String sourceName, int line, String lineSource, int lineOffset) {
        EvaluatorException ex = null;
        for (ErrorReporter reporter : chainedReporters) {
            try {
                reporter.error(message, sourceName, line, lineSource, lineOffset);
            } catch (EvaluatorException thrownByChainEx) {
                ex = thrownByChainEx;
View Full Code Here

        }
    }

    @Override
    public EvaluatorException runtimeError(String message, String sourceName, int line, String lineSource, int lineOffset) {
        EvaluatorException ex = null;
        for (ErrorReporter reporter : chainedReporters) {
            EvaluatorException returnedByChainEx = reporter.runtimeError(message, sourceName, line, lineSource, lineOffset);
            if (returnedByChainEx != null) {
                ex = returnedByChainEx;
            }
        }
View Full Code Here

            if (callFun == Scriptable.NOT_FOUND) {
                callFun = "callFunction"; // this will produce a better error message
            }
            ScriptRuntime.call(context, callFun, thrScope, callFunArgs, thrScope);
        } catch (JavaScriptException ex) {
            EvaluatorException ee =
                Context.reportRuntimeError(ToolErrorReporter.getMessage("msg.uncaughtJSException",
                                                                        ex.getMessage()));
            Throwable unwrapped = unwrap(ex);
            if (unwrapped instanceof ProcessingException) {
                throw (ProcessingException)unwrapped;
            }

            throw new CascadingRuntimeException(ee.getMessage(), unwrapped);
        } catch (EcmaError ee) {
            String msg = ToolErrorReporter.getMessage("msg.uncaughtJSException", ee.toString());
            if (ee.getSourceName() != null) {
                Context.reportRuntimeError(msg,
                                           ee.getSourceName(),
                                           ee.getLineNumber(),
                                           ee.getLineSource(),
                                           ee.getColumnNumber());
            } else {
                Context.reportRuntimeError(msg);
            }
            throw new CascadingRuntimeException(ee.getMessage(), ee);
        } finally {
            exitContext(thrScope);
        }
    }
View Full Code Here

        cocoon.setParameters(parameters);

        try {
            ((Function)handleContFunction).call(context, kScope, kScope, args);
        } catch (JavaScriptException ex) {
            EvaluatorException ee =
                Context.reportRuntimeError(ToolErrorReporter.getMessage("msg.uncaughtJSException",
                                                                        ex.getMessage()));
            Throwable unwrapped = unwrap(ex);
            if (unwrapped instanceof ProcessingException) {
                throw (ProcessingException)unwrapped;
            }

            throw new CascadingRuntimeException(ee.getMessage(), unwrapped);
        } catch (EcmaError ee) {
            String msg = ToolErrorReporter.getMessage("msg.uncaughtJSException", ee.toString());
            if (ee.getSourceName() != null) {
                Context.reportRuntimeError(msg,
                                           ee.getSourceName(),
                                           ee.getLineNumber(),
                                           ee.getLineSource(),
                                           ee.getColumnNumber());
            } else {
                Context.reportRuntimeError(msg);
            }
            throw new CascadingRuntimeException(ee.getMessage(), ee);
        } finally {
            Context.exit();
        }
    }
View Full Code Here

               String message, String sourceName, int line, String lineSource,
               int lineOffset) {
             if (errors == null) {
               throw new UnsupportedOperationException();
             }
             return new EvaluatorException(
               message, sourceName, line, lineSource, lineOffset);
           }
        };
        environment.setErrorReporter(testErrorReporter);
View Full Code Here

     * Throw an execption if the argument list isn't long enough for argument "pos".
     */
    public static void ensureArg(Object[] args, int pos)
    {
        if (pos >= args.length) {
            throw new EvaluatorException("Not enough arguments.");
        }
    }
View Full Code Here

    {
        Number n = numberArg(args, pos);
        if (n.doubleValue() == (double)n.intValue()) {
            return n.intValue();
        }
        throw new EvaluatorException("Not an integer");
    }
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.EvaluatorException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.