Skip to content

Commit 7af3716

Browse files
committed
fix: S3 error message
1 parent 8727a34 commit 7af3716

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/aws4fetch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export class AwsClient {
8787
this.region = region;
8888
/** @type {Map<string, ArrayBuffer>} */
8989
this.cache = cache || new Map();
90-
this.retries = retries != null ? retries : 2; // Up to 25.6 secs
90+
this.retries = retries != null ? retries : 0; // Up to 25.6 secs
9191
this.initRetryMs = initRetryMs || 50;
9292
}
9393

plugins/03.s3.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ export default defineNuxtPlugin({
6464
if (error?.$metadata?.httpStatusCode === 401) {
6565
await useAuth().logoutAndRedirect();
6666
}
67+
68+
// 处理 S3 客户端错误,优先抛出 error.message 作为新的 Error
69+
if (error?.Code) {
70+
throw new Error(error.Code);
71+
}
6772
throw error;
6873
}
6974
},

0 commit comments

Comments
 (0)