Skip to content

Commit 146a27f

Browse files
committed
change 403 error mapping from expired to service error
1 parent 48581d9 commit 146a27f

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/utils/AwsErrorMapper.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const CREDENTIAL_ERROR_NAMES = new Set([
1919
'UnrecognizedClientException',
2020
'ExpiredToken',
2121
'ExpiredTokenException',
22-
'AccessDeniedException',
2322
]);
2423

2524
const NETWORK_ERROR_NAMES = new Set([
@@ -46,7 +45,7 @@ function isCredentialError(error: AwsError): boolean {
4645
}
4746

4847
const statusCode = error.$metadata?.httpStatusCode;
49-
return statusCode === 401 || statusCode === 403;
48+
return statusCode === 401;
5049
}
5150

5251
function isNetworkError(error: AwsError): boolean {

tst/unit/utils/AwsErrorMapper.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ describe('mapAwsErrorToLspError', () => {
2323
expect(result.code).toBe(OnlineFeatureErrorCode.ExpiredCredentials);
2424
});
2525

26-
it('should map 403 status to ExpiredCredentials', () => {
26+
it('should map 403 status to AwsServiceError', () => {
2727
const error = { $metadata: { httpStatusCode: 403 }, message: 'Forbidden' };
2828
const result = mapAwsErrorToLspError(error);
29-
expect(result.code).toBe(OnlineFeatureErrorCode.ExpiredCredentials);
29+
expect(result.code).toBe(OnlineFeatureErrorCode.AwsServiceError);
3030
});
3131

3232
it('should map network errors to NoInternet', () => {

0 commit comments

Comments
 (0)