Error Handling
- Last UpdatedJun 24, 2025
- 1 minute read
- Engineering
- Integration Service 4.0
- Integrators
Always keep SDK methods in try catch block. If exception message is Empty, then try to read the Inner exception message.
string Url = "https://machinename:Port/";
CancellationTokenSource cancelToken = new CancellationTokenSource();
try
{
var engineeringDataClient = DataApiClientFactory.CreateDataApiClient<EngineeringClient>(host: Url, authType: AuthenticationType.NTLM, waitingTimeInMinutesForLiveData: 3, token: string.Empty, cancelToken);
var listOfDataSources = await engineeringDataClient.GetDataSources(filter: "kept for future purpose (optional)");
}
catch (Exception ex)
{
string message = ex.Message;
if (string.IsNullOrEmpty(message))
{
message = (ex.InnerException != null ? ex.InnerException.Message : string.Empty);
}
Console.WriteLine($"Message:{message}");
}
Custom Exceptions
-
InternalPubSubClientException: This exception raises when SDK is not able to create pub-sub client (In case of fetching the data from Product). Suggestion: Try to reinitiate request
-
DataPostMessageNotReceivedException: This exception raises when SDK exhausted the waiting time (this means SDK is not received message from DATA API which conveys the SDK of requested data availability in DATA API). Suggestion: Try to reinitiate request
-
EmptyDataObjectRecievedException: This exception raises when SDK received a notification with a error message from product. Suggestion: Read the error message and try to act accordingly.