fix(sync): (Codex) 规范化 Google Drive 和 OneDrive 的文件系统请求错误#1406
Open
cyfung1031 wants to merge 1 commit intomainfrom
Open
fix(sync): (Codex) 规范化 Google Drive 和 OneDrive 的文件系统请求错误#1406cyfung1031 wants to merge 1 commit intomainfrom
cyfung1031 wants to merge 1 commit intomainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
本 PR 新增一个轻量级的文件系统错误类型,并将其接入 Google Drive 和 OneDrive 的请求封装层。
主要改动:
FileSystemError,携带provider、status、code、retryable、conflict、auth、notFound、rateLimit和raw信息。isNotFoundErrorisConflictErrorisRateLimitErrorisAuthErrorFileSystemError。FileSystemError。nothen请求路径的原始Response返回行为,避免影响现有调用方。背景
后续 cloud sync 修复需要先有可靠的错误分类能力,例如:
在本 PR 之前,Google Drive 和 OneDrive 的请求封装会抛出由响应文本或 JSON 字符串构造的普通
Error。这会丢失 HTTP status/code 等结构化信息,上层只能依赖脆弱的字符串匹配。行为变化
对于普通 JSON 请求路径:
auth: true的FileSystemError。notFound: true的FileSystemError。conflict: true的FileSystemError。rateLimit: true且retryable: true的FileSystemError。retryable: true。刻意不改变的行为:
nothen的调用仍然返回原始Response。这样可以保持现有 delete/read 流程稳定,避免本 PR 扩大改动范围。WarpTokenError和WarpNetworkError导出,避免影响 WebDAV、S3 和现有同步逻辑。