Skip to content

Commit

Permalink
[Truffle] Translate load errors for JRuby when file can't be loaded v…
Browse files Browse the repository at this point in the history
…ia '-r' switch.
  • Loading branch information
nirvdrum committed Apr 21, 2015
1 parent 6f90864 commit 260cae0
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -155,6 +155,13 @@ public void init() {
truffleContext.getFeatureManager().require(requiredLibrary, null);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (RaiseException e) {
// Translate LoadErrors for JRuby since we're outside an ExceptionTranslatingNode.
if (e.getRubyException().getLogicalClass() == truffleContext.getCoreLibrary().getLoadErrorClass()) {
throw truffleContext.getRuntime().newLoadError(e.getRubyException().getMessage().toString(), requiredLibrary);
} else {
throw e;
}
}
}

Expand Down

0 comments on commit 260cae0

Please sign in to comment.