Raising an Error with a Clear Meaning
A raised error tells a caller that the promised operation could not complete normally. Its type and context help identify the next useful action.
- Source
- Anbloq
- Language
- English
- Created
- Updated
- Chapters
- 2
- Reading time
- 1 min
In this article2 chapters
Choose a concrete input rule
A count parser can accept digits and reject a negative numeric result with an error naming the count and supported range. The failed numeric validation is distinct from parsing invalid text.
Keep the caller's interest in view
If a command can recover by requesting a new value, report which input needs repair. A caller should be able to distinguish expected input failures from bugs in an unrelated operation. See testing exception details.[1]