Add an official mean of identifying traceback exceptions #1953
Description
Motivation
There is no good way to detect if a Throwable
is a traceback, which could be useful in cases where eg. such a traceback is added to a CompositeException
.
Desired solution
Add an official API to check if a Throwable
is a traceback.
Considered alternatives
The OnAssemblyException
being package-private means that instanceof
cannot be used. Relying on getClass().getCanonicalName()
from within user code is an alternative, but less than ideal compared to doing that from core codebase.
Another alternative would be to have a parameter to Exceptions.unwrap
to chose wether or not to filter out tracebacks, or having it always filter out tracebacks.
Additional context
checkpoint
operator adds the traceback as a suppressed exception. CompositeException
uses the same mechanism to gather its composites, so the traceback appears in the list when unwrapping the composite.