src/jdk/nashorn/api/scripting/ScriptObjectMirror.java
Print this page
*** 106,115 ****
--- 106,117 ----
final Object self = globalChanged? wrap(thiz, oldGlobal) : thiz;
return wrap(ScriptRuntime.apply((ScriptFunction)sobj, unwrap(self, global), unwrapArray(modArgs, global)), global);
}
throw new RuntimeException("not a function: " + toString());
+ } catch (final NashornException ne) {
+ throw ne.initEcmaError(global);
} catch (final RuntimeException | Error e) {
throw e;
} catch (final Throwable t) {
throw new RuntimeException(t);
} finally {
*** 133,142 ****
--- 135,146 ----
final Object[] modArgs = globalChanged? wrapArray(args, oldGlobal) : args;
return wrap(ScriptRuntime.construct((ScriptFunction)sobj, unwrapArray(modArgs, global)), global);
}
throw new RuntimeException("not a constructor: " + toString());
+ } catch (final NashornException ne) {
+ throw ne.initEcmaError(global);
} catch (final RuntimeException | Error e) {
throw e;
} catch (final Throwable t) {
throw new RuntimeException(t);
} finally {
*** 180,189 ****
--- 184,195 ----
} else if (val instanceof JSObject && ((JSObject)val).isFunction()) {
return ((JSObject)val).call(sobj, args);
}
throw new NoSuchMethodException("No such function " + functionName);
+ } catch (final NashornException ne) {
+ throw ne.initEcmaError(global);
} catch (final RuntimeException | Error e) {
throw e;
} catch (final Throwable t) {
throw new RuntimeException(t);
} finally {
*** 715,724 ****
--- 721,732 ----
if (globalChanged) {
Context.setGlobal(global);
}
try {
return callable.call();
+ } catch (final NashornException ne) {
+ throw ne.initEcmaError(global);
} catch (final RuntimeException e) {
throw e;
} catch (final Exception e) {
throw new AssertionError("Cannot happen", e);
} finally {