Error Codes and Human-Readable Messages

A stable code lets software branch on a result. A message explains the condition to a reader and can change with language or context.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. Trace two audiences
  2. Test behavior under another display language

Trace two audiences

For an invalid quantity, a program might receive a stable invalid-count reason while a screen explains that a positive integer is required. Structured reasons keep formatting out of the caller's logic.

Test behavior under another display language

Changing wording should leave the code and its expected handling intact. A function contract should say which parts of the reported result are stable.[1]

References

  1. Python Software Foundation, Python Tutorial: Errors and Exceptions ↩