Handling exceptions
This topic describes the exceptions that can be returned by xConnect and when they are likely to occur.
XdbUnavailableException
XdbUnavailableException
An XdbUnavailableException exception indicates that the xConnect services is unavailable or that the request has timed out. The XdbCollectionUnavailableException and XdbSearchUnavailableException exceptions both inherit XdbUnavailableException.
XdbExecutionException
XdbExecutionException
xConnect throws an XdbExecutionException when one or more operations in a batch fails to execute. Use client.GetOperations() to select the specific operations that failed. The following example selects any operations that failed because the PhoneNumberList facet already exists.
-
The
Statusproperty is available on all operations -XdbOperationStatus.Failedindicates a failed operation -
Result.Statusproperty is available on theSetFacetOperationandAddContactIdentifieroperations - theResultproperty may be null if a connection error prevented the operation from being executed -
Every operation has a nested
Exceptionproperty
Retrying operations after an XdbExecutionException
You can retry a failed operation by adding it to the client using the client.RegisterOperation() method and re-submitting the batch. This is useful if an operation failed due to a connectivity issue.
If an operation failed due to a concurrency issue, refer to the concurrency topic.
In the following example, an operation is retried after xConnect returned a XdbExecutionException, indicating that one or more operations failed: