Exception Tracking
Usage Intelligence is able to collect runtime exceptions from your application and then produce reports on the exceptions that were collected. Once an exception is tracked, Usage Intelligence will also save a snapshot of the current machine architecture so that you can later (through the on-line exception browser within the Usage Intelligence dashboard) investigate the exception details and pinpoint any specific OS or architecture related information that are the cause of common exceptions. Collection of exception data is done through the RUISDK.TrackException method.
The RUISDK.TrackException function logs an exception event with the supplied data.
RUISDK.TrackException can be called between RUISDK.StartSDK and RUISDK.StopSDK, and can be called zero or more times.
RUISDK.TrackException can be called while a New Registration is being performed (RUISDK.CreateConfig, RUISDK.StartSDK). However, the event data is not written to the log file until the New Registration completes, and if the New Registration fails, the data will be lost.
RUISDK.TrackException is an asynchronous function, returning immediately with further functionality executed on separate thread(s).
RUIResult RUISDK.TrackException (RUIExceptionEvent exceptionData, String sessionID = “”)
Parameters
The RUISDK.TrackException function has the following parameters.
Parameter |
Description |
||||||||||||||||||||||||||||||
exceptionData (RUIExceptionEvent) |
The exception data to log:
The content of exceptionData.className and exceptionData.methodName are conditioned and validated (after conditioning) with the following rules:
|
||||||||||||||||||||||||||||||
sessionID (String) |
An optional session ID. Different than V4 of the Usage Intelligence (Trackerbird) SDK, RUISDK.TrackException accepts a sessionID parameter. The usage requirements of the sessionID parameter are the following:
|
Returns
The RUISDK.TrackException function returns a RUIResult enum value with the following possible values.
Return |
Description |
ok |
Synchronous functionality successful. |
sdkInternalErrorFatal |
Irrecoverable internal fatal error. No further API calls should be made. |
sdkAborted |
A required New Registration has failed, and hence the SDK is aborted. RUISDK.StopSDK and RUISDK destructor are possible. |
suspended |
Instance has been instructed by Server to back-off. Will return to Running once back-off cleared. |
permanentlyDisabled |
Instance has been instructed by Server to disable. This is permanent, irrecoverable state. |
sdkOptedOut |
Instance has been instructed by the application to opt-out. |
configNotCreated |
Configuration has not been successfully created. |
sdkNotStarted |
SDK has not been successfully started. |
sdkAlreadyStopped |
SDK has already been successfully stopped. |
invalidSessionIDExpectedEmpty |
The sessionID is expected to be empty, and it was not. |
invalidSessionIDTooShort |
The sessionID violates its allowable minimum length. |
invalidSessionIDTooLong |
The sessionID violates its allowable maximum length. |
invalidSessionIDNotActive |
The sessionID is not currently in use. |
invalidParameterExpectedNonEmpty |
Some API parameter is expected to be non-empty, and is not. |
Code Example
The following is a code example of RUISDK.TrackException inside of a try catch statement so that Usage Intelligence can record it.
// Create instance
bool registerDefaultReachOut = true;
String ruiSDKDLLPath = "<path to Usage Intelligence SDK .NET library>";
mySDK = new RUISDK(registerDefaultReachOut, ruiSDKDLLPath);
// Other initialization.....
private void btnSave_Click(object sender, EventArgs e)
{
try
{
//Save Button Logic
}
catch (Exception ex)
{
RUIExceptionEvent myRUIExceptionData = new RUIExceptionEvent("Form1", ex.TargetSite, ex.Message, ex.StackTrace);
mySDK.TrackException(myRUIExceptionData);
}
}