Skip to content

Commit

Permalink
Bugfix: Do not show exceptions in admin UI which were caused by calls…
Browse files Browse the repository at this point in the history
… to assert() in application code
  • Loading branch information
vigorouscoding committed Feb 12, 2024
1 parent bc6ffe9 commit c06cfce
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -684,16 +684,17 @@ private static void reportError(final SecurityContext securityContext, final Gra
endColumnNumber = location.getEndColumn();
}

reportError(securityContext, entity, message, lineNumber, columnNumber, endLineNumber, endColumnNumber, snippet);
boolean broadcastToAdminUI = !(ex.asHostException() instanceof AssertException);

reportError(securityContext, entity, message, lineNumber, columnNumber, endLineNumber, endColumnNumber, snippet, broadcastToAdminUI);
}

private static void reportError(final SecurityContext securityContext, final GraphObject entity, final String message, final int lineNumber, final int columnNumber, final Snippet snippet) throws FrameworkException {

reportError(securityContext, entity, message, lineNumber, columnNumber, lineNumber, columnNumber, snippet);

reportError(securityContext, entity, message, lineNumber, columnNumber, lineNumber, columnNumber, snippet, true);
}

private static void reportError(final SecurityContext securityContext, final GraphObject entity, final String message, final int lineNumber, final int columnNumber, final int endLineNumber, final int endColumnNumber, final Snippet snippet) throws FrameworkException {
private static void reportError(final SecurityContext securityContext, final GraphObject entity, final String message, final int lineNumber, final int columnNumber, final int endLineNumber, final int endColumnNumber, final Snippet snippet, final boolean broadcastToAdminUI) throws FrameworkException {

final String entityName = snippet.getName();
final String entityDescription = (StringUtils.isNotBlank(entityName) ? "\"" + entityName + "\":" : "" ) + snippet.getCodeSource();
Expand Down Expand Up @@ -784,7 +785,10 @@ private static void reportError(final SecurityContext securityContext, final Gra

RuntimeEventLog.scripting(errorName, eventData);

TransactionCommand.simpleBroadcastGenericMessage(messageData, Predicate.only(securityContext.getSessionId()));
if (broadcastToAdminUI == true) {

TransactionCommand.simpleBroadcastGenericMessage(messageData, Predicate.only(securityContext.getSessionId()));
}

exceptionPrefix.append(snippet.getName()).append(":").append(lineNumber).append(":").append(columnNumber);

Expand Down

0 comments on commit c06cfce

Please sign in to comment.