Context
Related to PR #424 which demonstrates the pattern for modularisation by refactoring the connection module.
Request from: @leynos
Source: #424
Objective
Replace brittle string matching for EOF classification in codec-error world steps with type-safe downcasting.
Current situation
tests/worlds/codec_error/decoder_ops.rs:101 uses brittle string matching to classify EOF errors
- This is fragile and prone to breakage if error messages change
Proposed solution
Since CodecError::Eof becomes an io::Error carrying EofError internally (src/codec/error.rs:298):
- Downcast via
io::Error::get_ref() to EofError
- Delete the string-matching heuristic
- Use type-safe error classification instead
Benefits
- Type-safe error classification
- More robust to error message changes
- Eliminates brittle string matching
- Clearer intent and better maintainability
Context
Related to PR #424 which demonstrates the pattern for modularisation by refactoring the connection module.
Request from: @leynos
Source: #424
Objective
Replace brittle string matching for EOF classification in codec-error world steps with type-safe downcasting.
Current situation
tests/worlds/codec_error/decoder_ops.rs:101uses brittle string matching to classify EOF errorsProposed solution
Since
CodecError::Eofbecomes anio::ErrorcarryingEofErrorinternally (src/codec/error.rs:298):io::Error::get_ref()toEofErrorBenefits