This class will capture the root cause (last in a chain of causes)Throwable
and report
the exception type, class name, method name and thread name.
This class will attempt to report a class and method name that is relevant to the application
if at all possible. It does this by finding the root causeThrowable
,then checking each
StackTraceElement
for a class that is in a package list created bysetIncludedPackages(Context, Collection
,starting with the firstStackTraceElement
.
TheString
returned bygetDescription(String, Throwable)
will take the form Exception
class(@classname:methodname){threadname}.
SeegetBestStackTraceElement(Throwable)
andsetIncludedPackages(Context, Collection
for details.
Public Constructor Summary
Public Method Summary
String |
getDescription(StringthreadName,Throwablet)
Return a short description of a
Throwable suitable for reporting to Google Analytics. |
void |
setIncludedPackages(Contextcontext,Collection<String> additionalPackages)
Sets the list of packages considered relevant to the list of packages in the
Context
and the list of packages provided in the input parameteradditionalPackages . |
Protected Method Summary
StackTraceElement |
getBestStackTraceElement(Throwablet)
Return the first
StackTraceElement found that has a className in any packageName found
inincludedPackages . |
Throwable | |
String |
Inherited Method Summary
Public Constructors
Public Methods
public void setIncludedPackages (Contextcontext,Collection<String> additionalPackages)
Sets the list of packages considered relevant to the list of packages in theContext
and the list of packages provided in the input parameteradditionalPackages
.Either
parameter can be null.
Any package names stored from a previous call to this method will be cleared.
Parameters
context | anyContext for the application |
---|---|
additionalPackages | a collection of additional package names to add |
Protected Methods
protected StackTraceElement getBestStackTraceElement (Throwablet)
Return the firstStackTraceElement
found that has a className in any packageName found
inincludedPackages
.If none have a className in any packageName found inincludedPackages
,return the firstStackTraceElement
found. If theThrowable
does not contain anyStackTraceElement
s, return null.