Skip to content

Commit da25704

Browse files
committed
fix types and formatting
1 parent 3adba79 commit da25704

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/middleware-retry/src/retryMiddleware.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ export const retryMiddleware = (options: RetryResolvedConfig & Partial<Previousl
5656
if (isRequest) {
5757
request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`;
5858
}
59-
initialSystemClockOffset = options.systemClockOffset | 0;
59+
initialSystemClockOffset = options.systemClockOffset ?? 0 | 0;
6060
const { response, output } = await next(args);
6161
retryStrategy.recordSuccess(retryToken);
6262
output.$metadata.attempts = attempts + 1;
6363
output.$metadata.totalRetryDelay = totalRetryDelay;
6464
return { response, output };
6565
} catch (e: unknown) {
66-
const latestSystemClockOffset = options.systemClockOffset | 0;
66+
const latestSystemClockOffset = options.systemClockOffset ?? 0 | 0;
6767
const clockSkewCorrected = initialSystemClockOffset !== latestSystemClockOffset;
6868

6969
const sdkError = e as SkdErrorWithClockSkewMetadata;

packages/service-error-classification/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ export const isThrottlingError = (error: SdkError) =>
2323
* cause where the NodeHttpHandler does not decorate the Error with
2424
* the name "TimeoutError" to be checked by the TRANSIENT_ERROR_CODES condition.
2525
*/
26-
export const isTransientError = (error: SkdErrorWithClockSkewMetadata) =>
27-
error.$metadata?.clockSkewCorrected ||
26+
export const isTransientError = (error: SdkError | SkdErrorWithClockSkewMetadata) =>
27+
(error as SkdErrorWithClockSkewMetadata).$metadata?.clockSkewCorrected ||
2828
TRANSIENT_ERROR_CODES.includes(error.name) ||
2929
NODEJS_TIMEOUT_ERROR_CODES.includes((error as { code?: string })?.code || "") ||
3030
TRANSIENT_ERROR_STATUS_CODES.includes(error.$metadata?.httpStatusCode || 0);
3131

32-
export const isServerError = (error: SkdErrorWithClockSkewMetadata) => {
32+
export const isServerError = (error: SdkError | SkdErrorWithClockSkewMetadata) => {
3333
if (error.$metadata?.httpStatusCode !== undefined) {
3434
const statusCode = error.$metadata.httpStatusCode;
3535
if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) {

0 commit comments

Comments
 (0)