fix: try_json_parse で JSON パースエラーのみを捕捉するよう修正#26
Open
aobathree wants to merge 1 commit into
Open
Conversation
try_json_parse の裸の except: は KeyboardInterrupt や SystemExit を 含むすべての例外を「不正なJSON」エラーとして握りつぶしてしまうため、 JSON パース失敗を示す ValueError のみを捕捉するように変更しました。 requests の response.json() が送出する JSONDecodeError (json.JSONDecodeError / simplejson.JSONDecodeError) はいずれも ValueError のサブクラスであり、従来の正常系・異常系の挙動は 変わりません。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collaborator
|
プルリクエストの作成ありがとうございます。 |
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.
概要
utils.pyのtry_json_parseは裸のexcept:を使用しているため、KeyboardInterruptやSystemExitを含むすべての例外を「不正な JSON」エラーとして変換してしまい、障害時の原因特定を困難にします。変更内容
捕捉対象を
ValueErrorに限定しました。response.json()が JSON パース失敗時に送出するJSONDecodeError(json.JSONDecodeError/simplejson.JSONDecodeError)はいずれもValueErrorのサブクラスであるため、正常系・異常系の従来挙動は変わりません。🤖 Generated with Claude Code