Skip to content

Fix: replace bare catch with FormatException catch and logging in GetRealTimeOdds#32

Open
HashidaTKS wants to merge 1 commit intomasterfrom
fix/scraper-bare-catch-logging
Open

Fix: replace bare catch with FormatException catch and logging in GetRealTimeOdds#32
HashidaTKS wants to merge 1 commit intomasterfrom
fix/scraper-bare-catch-logging

Conversation

@HashidaTKS
Copy link
Copy Markdown
Owner

問題点

Scraper.GetRealTimeOdds() 内の馬番号パース処理で catch {} を使用していた(line 241-243)。

  • 全例外型を吸収するため、OutOfMemoryException 等の回復不能な例外も継続処理してしまう
  • 例外情報がログに残らないため、パース失敗の原因をデバッグできない

改善内容

  • catchcatch (FormatException ex) に変更(int.Parse が失敗する唯一の想定例外)
  • LoggerWrapper.Warn(ex) でログを記録してから continue

Test plan

  • 馬番号の形式が不正な場合に FormatException がキャッチされてログが出力されることを確認
  • 正常な馬番号では引き続き処理が続くことを確認

🤖 Generated with Claude Code

…TimeOdds

A bare catch{} in the horse number parsing loop silently swallowed all
exceptions including non-recoverable ones, and gave no diagnostic information.
Narrow to FormatException (the only expected failure when int.Parse encounters
a non-numeric string) and log the exception before continuing so parse failures
are observable in the log.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant