11
11
*/
12
12
public class ErrorEvent extends Event {
13
13
14
- // We may serialize this object, so we convert the Throwable to two strings to control its representation.
14
+ // All Events are intended to be eligible for serialization into a log or database, so we convert the Throwable to
15
+ // some Strings to determine its representation in a simple way.
15
16
// For flexibility in event handlers, it is tempting to hold on to the original Throwable instead of derived
16
17
// Strings. Exceptions are famously slow, but it's the initial creation and filling in the stack trace that are
17
- // slow. Once the instace exists, repeatedly examining its stack trace should not be prohibitively costly. Still,
18
- // we do probably gain some efficiency by converting the stack trace to a String once and reusing that.
18
+ // slow. Once the instance exists, repeatedly examining its stack trace should not be prohibitively costly.
19
19
20
20
public final String summary ;
21
21
@@ -25,11 +25,16 @@ public class ErrorEvent extends Event {
25
25
*/
26
26
public final String httpPath ;
27
27
28
+ /** The full stack trace of the exception that occurred. */
28
29
public final String stackTrace ;
29
30
31
+ /** A minimal stack trace showing the immediate cause within Conveyal code. */
32
+ public final String filteredStackTrace ;
33
+
30
34
public ErrorEvent (Throwable throwable , String httpPath ) {
31
35
this .summary = ExceptionUtils .shortCauseString (throwable );
32
36
this .stackTrace = ExceptionUtils .stackTraceString (throwable );
37
+ this .filteredStackTrace = ExceptionUtils .filterStackTrace (throwable );
33
38
this .httpPath = httpPath ;
34
39
}
35
40
@@ -56,7 +61,7 @@ public String traceWithContext (boolean verbose) {
56
61
if (verbose ) {
57
62
builder .append (stackTrace );
58
63
} else {
59
- builder .append (filterStackTrace ( stackTrace ) );
64
+ builder .append (filteredStackTrace );
60
65
}
61
66
return builder .toString ();
62
67
}
0 commit comments