Repository navigation
feat(aiscript): Mk:api の失敗を、本家と同じ error 値 (request_failed) で返す (#1249) - #1367
Merged
Merged
Conversation
サーバーのエラー応答・レート制限・通信断は throw をやめ、values.ERROR('request_failed',
{ code, message }) を返す。code は Misskey のエラーコードがあればそれ、無ければ NoteDeck の
種別。AiScript に try/catch は無く、止めると作者は失敗を自分の UI で扱えない。本家向けに
書かれた「error 値なら失敗」の分岐もそのまま動く。
呼べなかったもの (権限 gate の拒否 / アカウントが無い / 要求の形の誤り / 内部の失敗) は
止めるまま。Nd:call は変えない。
止まらなくなる分の手当て:
- error 値で返した失敗も実行ログに 1 行残す (io.onNotice、全実行面)
- プラグインが登録した capability の handler が error 値をそのまま戻したら、値の変換で
理由が潰れる前に、理由つきの失敗として呼び出し元 (AI など) に返す
- ドキュメント (4 言語): 書込のあとは必ず結果を確かめる。サーバーごとの差を自分の画面で
扱うなら Mk:api を使う
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 37 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Deploying notedeck with
|
| Latest commit: |
def479c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://cf466885.notedeck-d3a.pages.dev |
| Branch Preview URL: | https://feat-mk-api-error-value.notedeck-d3a.pages.dev |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
何を
Mk:apiの失敗の返し方を Misskey 本体に揃える (#1249 で決めた方針)。values.ERROR('request_failed', { code, message })を返すcodeは Misskey のエラーコード (NO_SUCH_NOTEなど) があればそれ、無いとき (通信断など) は NoteDeck の種別 (NETWORKなど)。本家向けに書いたres.info.codeの判定がそのまま動くNd:callは変えない (止まる。キャンセルだけ error 値)止まらなくなる分の手当て
io.onNotice。プラグイン / ウィジェット / ウィジェット編集 / AiScript カラム / Play・スクラッチパッドの全実行面)Unrecognized value type: error) 前に、理由つきの失敗として呼び出し元 (AI など) に返すCore:type(res) == "error"を確かめる。サーバーごとの差を自分の画面で扱うならNd:callではなくMk:apiを使うなぜ
AiScript に try/catch は無く、止まると作者は失敗を自分の UI で扱えない。ストアの配布物には本家向けの「error 値なら失敗」の分岐が既に多数あり、NoteDeck では通らない。互換性を約束する 2.0.0 の前に揃える (約束の後に変えると、結果を見ないコードが「失敗しても成功と表示する」ものに変わる)。
残る危険 (承知のうえ)
確認
Mk:apiの種別ごとの返し方と実行ログ、失敗の種別の判定 (remoteFailure)、登録 handler が error 値を戻したとき、本物の interpreter で本家の定型 (Core:type(res) == "error"とres.info.code) が動くことpnpm test(全件) /pnpm typecheck/pnpm lint/pnpm lint:docsは通過🤖 Generated with Claude Code