Fix: catch IOException instead of all exceptions in retry logic#19
Open
HashidaTKS wants to merge 1 commit into
Open
Fix: catch IOException instead of all exceptions in retry logic#19HashidaTKS wants to merge 1 commit into
HashidaTKS wants to merge 1 commit into
Conversation
… retry
Bare catch{} was silently absorbing all exception types including
OutOfMemoryException, ThreadAbortException, etc. beyond what was intended.
Narrow the catch to IOException (the only case where a retry is meaningful),
and log the exception before retrying so failures are observable.
Co-Authored-By: Claude Sonnet 4.6 <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.
問題点
XmlSerializerWrapper.Serialize()内のFile.Replace/File.Moveのリトライ処理で、例外型を指定しないcatch {}を使用していた。これにより
OutOfMemoryExceptionやThreadAbortExceptionなど、リトライしても解決しない例外まで吸収してしまい、また例外情報がログに残らないためデバッグが困難だった。改善内容
catchをcatch (IOException ex)に変更し、ファイルの一時的なロックが原因の場合にのみリトライするよう限定LoggerWrapper.Warn(ex)でログを記録し、問題が発生した際に原因を追跡可能にTest plan
IOException発生時にリトライが実行されることを確認IOException以外の例外は catch されずそのままスローされることを確認🤖 Generated with Claude Code