use of com.github.anba.es6draft.runtime.internal.InternalThrowable in project es6draft by anba.
the class ModuleOperations method toScriptException.
private static ScriptException toScriptException(ExecutionContext cx, Throwable e, SourceIdentifier moduleId, SourceIdentifier referredId) {
if (e instanceof CompletionException && e.getCause() != null) {
e = e.getCause();
}
ScriptException exception;
if (e instanceof NoSuchFileException) {
exception = new ResolutionException(Messages.Key.ModulesUnresolvedModule, moduleId.toString(), referredId.toString()).toScriptException(cx);
} else if (e instanceof IOException) {
exception = newInternalError(cx, e, Messages.Key.ModulesIOException, Objects.toString(e.getMessage(), ""));
} else if (e instanceof InternalThrowable) {
exception = ((InternalThrowable) e).toScriptException(cx);
} else {
cx.getRuntimeContext().getErrorReporter().accept(cx, e);
exception = newInternalError(cx, e, Messages.Key.InternalError, Objects.toString(e.getMessage(), ""));
}
return exception;
}
Aggregations