mirror of
https://github.com/cloudreve/frontend.git
synced 2025-12-25 19:52:48 +00:00
feat(OneDrive): show retry-after duration in error message if request is throttled, and mark such error as retryable.
This commit is contained in:
parent
547078fa21
commit
2ca4a957a5
|
|
@ -298,6 +298,7 @@
|
|||
"chunkUploadError": "Failed to upload chunk [{{index}}].",
|
||||
"conflictError": "The upload task for files with the same name is already being processed.",
|
||||
"chunkUploadErrorWithMsg": "Chunk upload failed: {{msg}}",
|
||||
"chunkUploadErrorWithRetryAfter": "(Please retry after {{retryAfter}}s)",
|
||||
"emptyFileError": "Uploading empty files to OneDrive is not supported, please create empty files via the Create File button.",
|
||||
"finishUploadError": "Unable to complete file upload.",
|
||||
"finishUploadErrorWithMsg": "Unable to complete file upload: {{msg}}",
|
||||
|
|
|
|||
|
|
@ -298,6 +298,7 @@
|
|||
"chunkUploadError": "分片 [{{index}}] 上传失败",
|
||||
"conflictError": "同名文件的上传任务已经在处理中",
|
||||
"chunkUploadErrorWithMsg": "分片上传失败: {{msg}}",
|
||||
"chunkUploadErrorWithRetryAfter": "(请在 {{retryAfter}} 秒后重试)",
|
||||
"emptyFileError": "暂不支持上传空文件至 OneDrive,请通过创建文件按钮创建空文件",
|
||||
"finishUploadError": "无法完成文件上传",
|
||||
"finishUploadErrorWithMsg": "无法完成文件上传: {{msg}}",
|
||||
|
|
|
|||
|
|
@ -228,9 +228,23 @@ export class OneDriveChunkError extends UploaderError {
|
|||
}
|
||||
|
||||
public Message(): string {
|
||||
return i18next.t(`uploader.chunkUploadErrorWithMsg`, {
|
||||
let msg = i18next.t(`uploader.chunkUploadErrorWithMsg`, {
|
||||
msg: this.message,
|
||||
});
|
||||
|
||||
if (this.response.error.retryAfterSeconds != undefined){
|
||||
msg += " "+i18next.t(`uploader.chunkUploadErrorWithRetryAfter`, {
|
||||
retryAfter: this.response.error.retryAfterSeconds,
|
||||
})
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
public Retryable(): boolean {
|
||||
return (
|
||||
super.Retryable() || this.response.error.retryAfterSeconds != undefined
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ export interface OneDriveError {
|
|||
innererror?: {
|
||||
code: string;
|
||||
};
|
||||
retryAfterSeconds?: number;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue