Skip to content

Commit

Permalink
More info when NPE is encountered (#11125)
Browse files Browse the repository at this point in the history
We are seeing this problem almost daily and need more info rather
urgently.
Related to #11088.
  • Loading branch information
hubertp authored Sep 18, 2024
1 parent 3768803 commit 2c362ea
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ private static Value getBindings() {
/** Returns a type object from the Enso runtime. */
public static Value getType(String moduleName, String typeName) {
var module = getBindings().invokeMember("get_module", moduleName);
return module.invokeMember("get_type", typeName);
try {
return module.invokeMember("get_type", typeName);
} catch (NullPointerException e) {
var ex =
new NullPointerException(
"Cannot get type for " + moduleName + " type: " + typeName + " at " + module);
ex.initCause(ex);
throw ex;
}
}

/** Calls a static method defined directly on a module (not inside of a type). */
Expand Down

0 comments on commit 2c362ea

Please sign in to comment.