API Testing · Senior · Question 60 of 75
Why should API error codes, not messages, be what clients and tests rely on?
- 1Codes are shorter, so responses are faster
- 2Messages change and get translated; codes stay stable
- 3Messages are never included in error responses
Show the answer
Correct answer: Messages change and get translated; codes stay stable
Explanation
Tests asserting exact message text break on every wording change. Stable machine-readable codes like ORDER_LIMIT_REACHED don't.