com.google.analytics.tracking.android
Class StandardExceptionParser

java.lang.Object
  extended by com.google.analytics.tracking.android.StandardExceptionParser
All Implemented Interfaces:
ExceptionParser

public class StandardExceptionParser
extends java.lang.Object
implements ExceptionParser

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, java.util.Collection), 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) for details.


Constructor Summary
StandardExceptionParser(Context context, java.util.Collection<java.lang.String> additionalPackages)
           
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardExceptionParser

public StandardExceptionParser(Context context,
                               java.util.Collection<java.lang.String> additionalPackages)
Method Detail

setIncludedPackages

public 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. 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

getDescription

public java.lang.String getDescription(java.lang.String threadName,
                                       java.lang.Throwable t)
Description copied from interface: ExceptionParser
Return a short description of a Throwable suitable for reporting to Google Analytics.

Specified by:
getDescription in interface ExceptionParser
Parameters:
threadName - the name of the Thread that got the exception, or null
t - the Throwable
Returns:
the description