Changelog - 2026-10-15
isApplicationError checks the whole shape
Bug Fix Behavior ChangeIn one line. A plain Error with a statusCode is no longer an ApplicationError.
typescript
const httpError = Object.assign(new Error('Request failed'), { statusCode: 502 });
isApplicationError(httpError); // false - it was true
isApplicationError(getError({ message: 'x', statusCode: 400 })); // true, as beforeWhat changed
isApplicationError()checked onlyinstanceof Errorand a numericstatusCode, yet narrowed the type toApplicationError. Code after the guard then readnormalizedor calledtoFilledText()on an error that had neither, and crashed.- The guard now also requires
normalizedto be an object with a stringtext. It still tests shape, not class identity, so anApplicationErrorfrom the other build copy (CJS against ESM) still matches. - This also fixes a worker that encoded such an error as an
ApplicationErrorenvelope with nonormalized, and the search connectors and mail service rethrowing it unwrapped instead of sanitizing it as a 503 or 500.
Who is affected
- Code that relied on a
statusCode-only error passing the guard. Build the error withgetError, or checkstatusCodeyourself. - An
ApplicationErrorfrom a copy older than 0.2.2-0. It still matches, but has notoFilledText(). - Everyone else. No change.