File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " cos-nodejs-sdk-v5" ,
3
- "version" : " 2.16.0-beta.5 " ,
3
+ "version" : " 2.16.0-beta.6 " ,
4
4
"description" : " cos nodejs sdk v5" ,
5
5
"main" : " index.js" ,
6
6
"types" : " index.d.ts" ,
Original file line number Diff line number Diff line change @@ -582,6 +582,27 @@ function getBucketPolicy(params, callback) {
582
582
return callback ( util . error ( err , { ErrorStatus : 'Method Not Allowed' } ) ) ;
583
583
}
584
584
if ( err . statusCode && err . statusCode === 404 ) {
585
+ /**
586
+ * 兼容 New COS 404 错误
587
+ */
588
+ try {
589
+ if ( err
590
+ && err . error
591
+ && err . error . Code
592
+ && ( err . error . Code === 'NoSuchPolicy' || err . error . Code === 'NoSuchPolicyVersion' )
593
+ ) {
594
+ err . code = '404' ;
595
+ err . message = 'Policy Not found' ;
596
+ err . error . code = '404' ;
597
+ err . error . message = 'Policy Not found' ;
598
+ err . error . statusCode = err . statusCode ;
599
+ err . error . headers = err . headers ;
600
+ err . error . url = err . url ;
601
+ err . error . method = err . method ;
602
+ err . error . ErrorStatus = 'Policy Not Found' ;
603
+ }
604
+ } catch ( error ) {
605
+ }
585
606
return callback ( util . error ( err , { ErrorStatus : 'Policy Not Found' } ) ) ;
586
607
}
587
608
return callback ( err ) ;
You can’t perform that action at this time.
0 commit comments