AR51Exception
namespace AR51.Net;
public sealed class AR51Exception : Exception
Implements: Exception
Thrown when a call to the AR 51 system fails. ErrorCode says why.
Cancellation is reported as OperationCanceledException and use after dispose as ObjectDisposedException, as usual in .NET.
How-to
This page is reference (facts only). For a walkthrough with a complete sample, see the Connecting guide.
Example
try
{
await ar51.Calibration.StartCalibrationAsync();
}
catch (AR51Exception exception) when (exception.ErrorCode == AR51ErrorCode.Rejected)
{
Console.WriteLine($"Refused by the server: {exception.Message}"); // e.g. a calibration is already running
}
Properties
| Property | Type | Access | Description |
|---|---|---|---|
ErrorCode | AR51ErrorCode | get | What went wrong. |
Method summary
| Method | Returns | |
|---|---|---|
Constructor | — | constructor |
→ Full descriptions in Method details below.
Method details
Constructor
method
public AR51Exception(AR51ErrorCode errorCode, string message, Exception? innerException = null);
Creates the exception.
Parameters
messagestringA description for logs and developers.
innerExceptionException?The underlying error, if any. Optional.
Related types
Small types used by this class, documented here.
AR51ErrorCode
enumpublic enum AR51ErrorCode
What went wrong in a AR51Exception.
| Value | Meaning |
|---|---|
Unknown = 0 | An unexpected error. See the inner exception. |
ServiceUnavailable = 1 | The server, or the service needed for the call, is not reachable right now. |
ConnectionLost = 2 | The connection dropped while the call was running. |
Timeout = 3 | The server did not answer in time. |
ServerError = 4 | The server failed while handling the request. Retrying is unlikely to help until the server is fixed or restarted. |
Rejected = 5 | The server understood the request and refused it, for example a calibration is already running or a camera does not exist. Exception.Message carries the server's reason; the request may succeed later. |
See also
- Connecting guide — walkthrough with a complete, compiled sample
- Class index — every AR51.Net type
- Data conventions, threading and errors
Was this page helpful?