Table of Contents

Class YdbTransientExceptionDetector

Namespace
LinqToDB.Internal.DataProvider.Ydb
Assembly
linq2db.dll

Detector for identifying whether an exception represents a transient YDB error, implemented without a hard dependency on Ydb.Sdk.

Works by inspecting two properties of YdbException:

  • bool IsTransient — indicates if the error is transient (temporary).
  • enum Code — contains the YDB status code for the error.
public static class YdbTransientExceptionDetector
Inheritance
object
YdbTransientExceptionDetector

Methods

ShouldRetryOn(Exception, bool)

Determines whether the given exception should trigger a retry attempt according to minimal YDB retry strategy rules.

The logic closely follows the official YDB SDK: it considers transient statuses and certain service-level timeouts.

public static bool ShouldRetryOn(Exception ex, bool enableRetryIdempotence)

Parameters

ex Exception

The exception to evaluate.

enableRetryIdempotence bool

If true, adds additional YDB codes that should be retried based on SDK retry schemes. If false, only the IsTransient flag is considered.

Returns

bool

true if the operation should be retried; otherwise, false.

TryGetCodeAndTransient(Exception, out string?, out bool)

Reads the YDB Code property (status enum) as a string and also retrieves the IsTransient flag.

public static bool TryGetCodeAndTransient(Exception ydbEx, out string? codeName, out bool isTransient)

Parameters

ydbEx Exception

The YDB exception instance to inspect.

codeName string

Outputs the name of the status code as a string.

isTransient bool

Outputs whether the error is transient.

Returns

bool

true if the Code property was successfully read, otherwise false.

TryGetYdbException(Exception, out Exception?)

Checks whether there is a YDB exception either at the top level or nested inside the provided exception hierarchy.

public static bool TryGetYdbException(Exception ex, out Exception? ydbEx)

Parameters

ex Exception

The exception to search.

ydbEx Exception

When this method returns true, contains the first discovered YDB exception. Otherwise, null.

Returns

bool

true if a YdbException was found, otherwise false.