Skip to main content

AR51Exception

class · sealed thread-safe
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​

PropertyTypeAccessDescription
ErrorCodeAR51ErrorCodegetWhat went wrong.

Method summary​

MethodReturns
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
errorCodeAR51ErrorCodeWhat went wrong.
messagestringA description for logs and developers.
innerExceptionException?The underlying error, if any. Optional.

Small types used by this class, documented here.

AR51ErrorCode​

enum
public enum AR51ErrorCode

What went wrong in a AR51Exception.

ValueMeaning
Unknown = 0An unexpected error. See the inner exception.
ServiceUnavailable = 1The server, or the service needed for the call, is not reachable right now.
ConnectionLost = 2The connection dropped while the call was running.
Timeout = 3The server did not answer in time.
ServerError = 4The server failed while handling the request. Retrying is unlikely to help until the server is fixed or restarted.
Rejected = 5The 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​

Was this page helpful?