Skip to content

Commit

Permalink
Simplify logic in NGExceptionPage(/Development)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugithordarson committed Mar 1, 2024
1 parent b248775 commit a2374a8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public LocalDateTime now() {
* @return First line of the stack trace, essentially the causing line.
*/
public StackTraceElement firstLineOfTrace() {
StackTraceElement[] stackTrace = originalThrowable().getStackTrace();
StackTraceElement[] stackTrace = exception().getStackTrace();

if( stackTrace.length == 0 ) {
return null;
Expand Down Expand Up @@ -227,20 +227,6 @@ public void setException( Throwable value ) {
_exception = value;
}

/**
* @return The original wrapped throwable (by walking up exception.cause until we reach the top)
*/
public Throwable originalThrowable() {
Throwable result = exception();

// FIXME: We're missing a nice mechanism to go don the "cause" path // Hugi 2024-02-11
// while( result.getCause() != null ) {
// result = result.getCause();
// }

return result;
}

/**
* @return The CSS class of the current row in the stack trace table.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@
</head>
<body>
<div class="container">
<h3><wo:str value="$originalThrowable.class.name" /></h3>
<div class="exception-message"><wo:str value="$originalThrowable.getMessage" /> <div class="time"><wo:str value="$now" /></div></div>
<h3><wo:str value="$exception.class.name" /></h3>
<div class="exception-message"><wo:str value="$exception.message" /> <div class="time"><wo:str value="$now" /></div></div>
<table>
<tr>
<th>File</th>
<th>Line #</th>
<th>Method</th>
<th>Package</th>
</tr>
<wo:repetition list="$originalThrowable.stackTrace" item="$currentStackTraceElement">
<wo:repetition list="$exception.stackTrace" item="$currentStackTraceElement">
<wo:container elementName="tr" class="$currentRowClass">
<td><wo:str value="$currentStackTraceElement.fileName" /></td>
<td><wo:str value="$currentStackTraceElement.lineNumber" /></td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@
</head>
<body>
<div class="container">
<h3><wo:str value="$originalThrowable.class.name" /></h3>
<div class="exception-message"><wo:str value="$originalThrowable.getMessage" /> <div class="time"><wo:str value="$now" /></div></div>
<h3><wo:str value="$exception.class.name" /></h3>
<div class="exception-message"><wo:str value="$exception.getMessage" /> <div class="time"><wo:str value="$now" /></div></div>
<wo:if condition="$showSource">
<div class="filename-container"><strong><wo:str value="$firstLineOfTrace.fileName" /></strong></div>
<div class="src-container">
Expand All @@ -112,7 +112,7 @@ <h3><wo:str value="$originalThrowable.class.name" /></h3>
<th>Method</th>
<th>Package</th>
</tr>
<wo:repetition list="$originalThrowable.stackTrace" item="$currentStackTraceElement">
<wo:repetition list="$exception.stackTrace" item="$currentStackTraceElement">
<wo:container elementName="tr" class="$currentRowClass">
<td><wo:str value="$currentStackTraceElement.fileName" /></td>
<td><wo:str value="$currentStackTraceElement.lineNumber" /></td>
Expand Down

0 comments on commit a2374a8

Please sign in to comment.