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
-
objectYdbTransientExceptionDetector
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
exExceptionThe exception to evaluate.
enableRetryIdempotenceboolIf true, adds additional YDB codes that should be retried based on SDK retry schemes. If false, only the
IsTransientflag is considered.
Returns
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
ydbExExceptionThe YDB exception instance to inspect.
codeNamestringOutputs the name of the status code as a string.
isTransientboolOutputs whether the error is transient.
Returns
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
exExceptionThe exception to search.
ydbExExceptionWhen this method returns true, contains the first discovered YDB exception. Otherwise, null.