Turning a Known Error into a Structured Result
An interface can translate a well-understood error into fields used by callers while allowing unexpected failures to keep their diagnostic context.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Trace a field parse
A nonnumeric count can become a result with the source row, field, and expected kind of value. Typed reader results give a pattern for that output.
Check the boundary
If loading the file raises unexpectedly, that should not become a bad count message. Limit caught cases and verify one normal conversion, one known bad value, and one independent storage failure. See a small exception boundary.[1]