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"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis page details the \u003ccode\u003eTransientFaultDetector\u003c/code\u003e class, which is utilized for detecting transient faults in Spanner transactions, allowing for retry strategies to be implemented.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eIsTransientSpannerFault\u003c/code\u003e method, which takes an exception as a parameter, is used to determine if an exception signifies a transient error that could be resolved with a retry.\u003c/p\u003e\n"],["\u003cp\u003eThe latest available version is \u003ccode\u003e5.0.0-beta05\u003c/code\u003e, but other versions of the library, ranging from \u003ccode\u003e3.5.0\u003c/code\u003e to \u003ccode\u003e4.6.0\u003c/code\u003e, are also documented and available for reference.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eTransientFaultDetector\u003c/code\u003e class inherits from the base \u003ccode\u003eObject\u003c/code\u003e class and includes methods like \u003ccode\u003eGetHashCode()\u003c/code\u003e, \u003ccode\u003eGetType()\u003c/code\u003e, \u003ccode\u003eMemberwiseClone()\u003c/code\u003e, and \u003ccode\u003eToString()\u003c/code\u003e, along with its specific method, \u003ccode\u003eIsTransientSpannerFault(Exception)\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,[]]