---
title: "Processing request execution errors"
slug: "processing-request-execution-errors"
abstract: "Recommendations for handling processing errors."
---
# Processing request execution errors

The error handling strategy of the Universal Tracker SDK aims at:

- Simplifying the creation of alert messages.
- Providing sufficient information for debugging.

In order to show a concise, informative alert message, you need to know what causes the error. This is why the messages generated by the .NET framework are grouped according to the request processing flow:

- *ProcessUserRequestException* – unable to build an HTTP request from the user’s request.
- *LoadDataFromNetworkException* – TCP or HTTP protocol physical connection errors.
- *ParserException* – unable to handle server response properly.

The `SitecoreUTSdkException` class is a common base class of all the exceptions.

The recommended way of handling errors is as follows:

```csharp
try
{
	var locationEventRequest = UTRequestBuilder.LocationEvent(lat, lon)
                                             .Build();

  var response = await session. TrackLocationEventAsync(locationEventRequest );

// Process response
}
catch(ProcessUserRequestException)
{
// HTTP request construction failed
}
catch(LoadDataFromNetworkException)
{
// Connection error
}
catch(ParserException)
{
// Server response is not valid
}
catch(SitecoreUTSdkException)
{
// Some Item Universal Tracker API response processing error has occurred.
// This code should not be reached in this example.
}
catch(Exception)
{
// Some exception has been thrown.
// This code should not be reached in this example.
}
```

Client application developers can access the original error object in the `Exception.InnerException` property, and the error stack trace in the *Exception.StackTrace* property.

```csharp
try
{
  var session = this.instanceSettings.GetSession();

  var locationEventRequest = UTRequestBuilder.LocationEvent(lat, lon)
                                             .Build();

  var response = await session. TrackLocationEventAsync(locationEventRequest);

// Process response
}

catch(Exception e)
{
  Debug.WriteLine(e.Message);

  Exception originalError =  e.InnerException;
  Debug.WriteLine(originalError.Message); // access original error
  Debug.WriteLine(originalError.StackTrace);
}
```

To avoid having redundant code, you should catch only the `SitecoreUTSdkException` exception and handle it in a separate class using the `Type.Equals()` method.

```csharp
try
{
  var locationEventRequest = UTRequestBuilder.LocationEvent(lat, lon)
                                             .Build();

  var response = await session. TrackLocationEventAsync(locationEventRequest);

// Process response
}
catch(SitecoreUTSdkException ex)
{
  this.MyErrorProcessor.ShowAlertForSitecoreUTSdkError(ex);
}
catch(Exception ex)
{
  this.MyErrorProcessor.ShowAlertForUnexpectedError(ex);
}
```
> [!note]
> The Universal Tracker SDK does not provide any error classes that show alerts because they may vary depending on the target platform, and may require customization.