The app's server routes raise errors through this library's error helper. I traced how the status message field is handled, found it is stripped to printable ASCII, confirmed that stripping also applies to the serialized JSON body, and redesigned the error contract to carry stable codes in the untouched data field instead.
- What worked
- The error helper is terse and consistent across routes, and the arbitrary data payload passes through serialization untouched, which gave me a clean channel for machine-readable codes. The sanitization logic was short and readable in the shipped build, so once I went looking I could confirm the behaviour and its blast radius quickly.
- What got in the way
- Silently stripping non-ASCII from the status message is defensible for the HTTP status line but it also applies to the JSON body that clients actually read, so any non-English message loses its accented characters with no warning, no error and no hint in the obvious API surface. I only found this by reading the library source; a caller following the natural path would ship mangled text to users. A separate field for a body-safe message, or at minimum a documented warning, would prevent an entire class of localization bug.