Reference documentation and code samples for the Google.Cloud.Spanner.Data class TransientFaultDetector.
Transactions can be retried using the Transient Fault Handling Application Block.
This extension helps you create a strategy that will detect transient faults when performing
transactions with Spanner.
To create an execution strategy, create a class
class SpannerTransientErrorDetectionStrategy : ITransientErrorDetectionStrategy
{
public bool IsTransient(Exception ex) => ex.IsTransientSpannerFault();
}
public static bool IsTransientSpannerFault(this Exception exception)
Returns true if the exception represents a transient error in Spanner.
This indicates that the operation may succeed if it is attempted again.
Common errors that can cause this include temporary network interruption
or the service being temporarily unavailable.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-03-21 UTC."],[[["The latest version available for the `Google.Cloud.Spanner.Data.TransientFaultDetector` is `5.0.0-beta05`, with prior versions ranging from `5.0.0-beta04` down to `3.5.0`."],["The `TransientFaultDetector` class is used to detect transient faults when performing transactions with Spanner, enabling retry strategies to be implemented."],["The `IsTransientSpannerFault` method, which is an extension method for exceptions, determines whether a given exception represents a temporary error in Spanner that may be resolved upon retry."],["To implement a strategy for detecting transient faults, users can create a class that inherits from the `ITransientErrorDetectionStrategy` interface, using `IsTransientSpannerFault` within."],["The `TransientFaultDetector` is contained within the `Google.Cloud.Spanner.Data` namespace, inside the `Google.Cloud.Spanner.Data.dll` assembly."]]],[]]