public class StandardExceptionParser extends java.lang.Object implements ExceptionParser
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, java.util.Collection<java.lang.String>), starting
with the first StackTraceElement.
The String returned by getDescription(java.lang.Throwable, java.lang.StackTraceElement, java.lang.String) will take on the form
Exception class(@classname:methodname){threadname}.
See getBestStackTraceElement(java.lang.Throwable) and setIncludedPackages(Context, java.util.Collection<java.lang.String>) for
details.
| Constructor and Description |
|---|
StandardExceptionParser(Context context,
java.util.Collection<java.lang.String> additionalPackages) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getDescription(java.lang.String threadName,
java.lang.Throwable t)
Return a short description of a
Throwable suitable for
reporting to Google Analytics. |
void |
setIncludedPackages(Context context,
java.util.Collection<java.lang.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. |
public StandardExceptionParser(Context context,
java.util.Collection<java.lang.String> additionalPackages)
public void setIncludedPackages(Context context,
java.util.Collection<java.lang.String> additionalPackages)
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.
context - any Context for the applicationadditionalPackages - a collection of additional package names to addpublic java.lang.String getDescription(java.lang.String threadName,
java.lang.Throwable t)
ExceptionParserThrowable suitable for
reporting to Google Analytics.getDescription in interface ExceptionParserthreadName - the name of the Thread that got the exception, or nullt - the Throwable