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 cause
Throwable
, then checking each StackTraceElement
for a class
that is in a package list created by setIncludedPackages(Context, Collection
, starting
with the first StackTraceElement
.
The String
returned by getDescription(String, Throwable)
will take the form
Exception class(@classname:methodname){threadname}.
See getBestStackTraceElement(Throwable)
and setIncludedPackages(Context, Collection
for
details.
Public Constructor Summary
Public Method Summary
String |
getDescription(String threadName, Throwable t)
Return a short description of a
Throwable suitable for
reporting to Google Analytics. |
void |
setIncludedPackages(Context context, 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 parameter additionalPackages . |
Protected Method Summary
StackTraceElement |
getBestStackTraceElement(Throwable t)
Return the first
StackTraceElement found that has a className in
any packageName found in includedPackages . |
Throwable | |
String |
Inherited Method Summary
Public Constructors
Public Methods
public void setIncludedPackages (Context context, 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 parameter additionalPackages
. Either parameter can be null.
Any package names stored from a previous call to this method will be cleared.
Parameters
context | any Context for the application |
---|---|
additionalPackages | a collection of additional package names to add |
Protected Methods
protected StackTraceElement getBestStackTraceElement (Throwable t)
Return the first StackTraceElement
found that has a className in
any packageName found in includedPackages
. If none have a
className in any packageName found in includedPackages
, return
the first StackTraceElement
found. If the Throwable
does
not contain any StackTraceElement
s, return null.