File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
service-error-classification/src Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -56,14 +56,14 @@ export const retryMiddleware = (options: RetryResolvedConfig & Partial<Previousl
56
56
if ( isRequest ) {
57
57
request . headers [ REQUEST_HEADER ] = `attempt=${ attempts + 1 } ; max=${ maxAttempts } ` ;
58
58
}
59
- initialSystemClockOffset = options . systemClockOffset | 0 ;
59
+ initialSystemClockOffset = options . systemClockOffset ?? 0 | 0 ;
60
60
const { response, output } = await next ( args ) ;
61
61
retryStrategy . recordSuccess ( retryToken ) ;
62
62
output . $metadata . attempts = attempts + 1 ;
63
63
output . $metadata . totalRetryDelay = totalRetryDelay ;
64
64
return { response, output } ;
65
65
} catch ( e : unknown ) {
66
- const latestSystemClockOffset = options . systemClockOffset | 0 ;
66
+ const latestSystemClockOffset = options . systemClockOffset ?? 0 | 0 ;
67
67
const clockSkewCorrected = initialSystemClockOffset !== latestSystemClockOffset ;
68
68
69
69
const sdkError = e as SkdErrorWithClockSkewMetadata ;
Original file line number Diff line number Diff line change @@ -23,13 +23,13 @@ export const isThrottlingError = (error: SdkError) =>
23
23
* cause where the NodeHttpHandler does not decorate the Error with
24
24
* the name "TimeoutError" to be checked by the TRANSIENT_ERROR_CODES condition.
25
25
*/
26
- export const isTransientError = ( error : SkdErrorWithClockSkewMetadata ) =>
27
- error . $metadata ?. clockSkewCorrected ||
26
+ export const isTransientError = ( error : SdkError | SkdErrorWithClockSkewMetadata ) =>
27
+ ( error as SkdErrorWithClockSkewMetadata ) . $metadata ?. clockSkewCorrected ||
28
28
TRANSIENT_ERROR_CODES . includes ( error . name ) ||
29
29
NODEJS_TIMEOUT_ERROR_CODES . includes ( ( error as { code ?: string } ) ?. code || "" ) ||
30
30
TRANSIENT_ERROR_STATUS_CODES . includes ( error . $metadata ?. httpStatusCode || 0 ) ;
31
31
32
- export const isServerError = ( error : SkdErrorWithClockSkewMetadata ) => {
32
+ export const isServerError = ( error : SdkError | SkdErrorWithClockSkewMetadata ) => {
33
33
if ( error . $metadata ?. httpStatusCode !== undefined ) {
34
34
const statusCode = error . $metadata . httpStatusCode ;
35
35
if ( 500 <= statusCode && statusCode <= 599 && ! isTransientError ( error ) ) {
You can’t perform that action at this time.
0 commit comments