refactor: エラー型の粒度を細分化する - #48
Merged
Merged
Conversation
Release v0.7.0
文字列ベースの Auth(String) は code が一律 "AUTH" になり、呼び出し側が 回復手段を選べなかった。また Misskey が返す error.code は Api の message に埋め込まれるだけで、消費者側が文字列を parse して復元していた。 - Auth(String) → Auth(AuthErrorKind): NoToken / MiAuthFailed / MiAuthPending / MiAuthMalformed / SessionInvalid / CredentialMissing。code() は AUTH_ 接頭辞付きで variant ごとに分かれる - Api に api_code: Option<String> を追加し、serialize に apiCode として出す。 request() はサーバー由来の error.code をそのまま載せる - WebSocket(String) を削除(生成箇所がゼロの死んだ variant) - Internal(String) を追加。認証と無関係な内部不整合の受け皿とし、 safe_message() では詳細を伏せる Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
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.
なぜ
Auth(String)はcode()が一律"AUTH"になるため、消費者は「再ログインが要る」のか「MiAuth をやり直す」のかを判別できなかった。またサーバーが返すerror.codeはApiのmessageに埋め込まれるだけで、消費側 (notedeck) が正規表現でメッセージから復元していた。変更
Auth(String)→Auth(AuthErrorKind)。NoToken/MiAuthFailed(status)/MiAuthPending/MiAuthMalformed/SessionInvalid/CredentialMissingに分け、code()はAUTH_接頭辞付きで variant ごとに分かれるApiにapi_code: Option<String>を追加し、serialize にapiCodeとして出す。request()はサーバー由来のerror.codeをそのまま載せるWebSocket(String)を削除(生成箇所がゼロの死んだ variant。streaming はConnectionClosed/NoConnection/InvalidInputを使っている)Internal(String)を追加。認証と無関係な内部不整合の受け皿とし、safe_message()では詳細を伏せる確認
cargo test200 passedcargo clippy --all-targets --all-features -- -D warnings/--no-default-featuresともに警告なしref: notedeck#327
🤖 Generated with Claude Code