Skip to content

Commit

Permalink
More info when we fail to log AssertError (enso-org#11113)
Browse files Browse the repository at this point in the history
Motivation:
```
Caused by: java.lang.AssertionError: No polyglot context is entered. A language or context reference must not be used if there is no polyglot context entered.
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotFastThreadLocals.assertValidGet(PolyglotFastThreadLocals.java:481)
	at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotFastThreadLocals$ContextReferenceImpl.get(PolyglotFastThreadLocals.java:513)
 	at org.enso.runtime/org.enso.interpreter.runtime.EnsoContext.get(EnsoContext.java:246)
	at org.enso.runtime/org.enso.interpreter.runtime.error.PanicException.computeMessage(PanicException.java:90)
```
  • Loading branch information
hubertp authored Sep 17, 2024
1 parent 567910a commit 862100c
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,15 @@ private String computeMessage() {
info = library.getExceptionMessage(this);
msg = library.asString(info);
} catch (AssertionError | UnsupportedMessageException e) {
var ctx = EnsoContext.get(null);
ctx.getLogger().log(Level.WARNING, "Cannot convert " + info + " to string", e);
msg = TypeToDisplayTextNode.getUncached().execute(payload);
try {
var ctx = EnsoContext.get(null);
ctx.getLogger().log(Level.WARNING, "Cannot convert " + info + " to string", e);
msg = TypeToDisplayTextNode.getUncached().execute(payload);
} catch (AssertionError assertionError) {
throw new AssertionError(
"Failed to log failed conversion of " + info + " to string and payload " + payload,
assertionError);
}
}
cacheMessage = msg;
return msg;
Expand Down

0 comments on commit 862100c

Please sign in to comment.