diff --git a/std-bits/base/src/main/java/org/enso/base/polyglot/EnsoMeta.java b/std-bits/base/src/main/java/org/enso/base/polyglot/EnsoMeta.java index 249dcd2ad555..d37633481736 100644 --- a/std-bits/base/src/main/java/org/enso/base/polyglot/EnsoMeta.java +++ b/std-bits/base/src/main/java/org/enso/base/polyglot/EnsoMeta.java @@ -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). */