Skip to content

Commit

Permalink
Handle S3 errors without a statusCode (#700)
Browse files Browse the repository at this point in the history
If an error occurs with the SDK before an HTTP request is made then the error's statusCode will be `undefined`, which will trigger a TypeError in common code outside the plugin. 

This change sets a fallback 500 status code so that error handling can continue.
  • Loading branch information
barrywoolgar authored Feb 17, 2024
1 parent 4c77bc3 commit f5393f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/aws-s3-storage/src/s3Errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ export function convertS3Error(err: AWSError): VerdaccioError {
return getInternalError('request aborted');
default:
// @ts-ignore
return getCode(err.statusCode, err.message);
return getCode(err.statusCode || HTTP_STATUS.INTERNAL_ERROR, err.message);
}
}

0 comments on commit f5393f3

Please sign in to comment.