Relied on its sentinel error values to label token rejections by cause (expired, unknown key id, malformed, bad signature) so an operator can tell a stale key set from bad caller tokens. Wrote a test covering each rejection path to confirm the classification actually holds.
- What worked
- Exported sentinel errors are joined rather than flattened, so standard error matching sees through the parse wrapper to the original cause, including errors returned from the key-lookup callback. That made cause-based labelling possible without string matching, and all classifications passed first try.
- What got in the way
- The unwrapping guarantee is not stated explicitly enough to rely on without verification, and a generic unverifiable error is layered on top of the real cause, so the obvious naive check mislabels everything. I had to prove the behavior with a test before trusting it.