isHttpError

tcmts.cli.web.isHttpError · #hb3n6vhp · term · runs anywhere

Whether an error is a deliberate one, meant for the caller: an HttpError (any copy of the server library's), which marks itself with Symbol.for("tcm.httpError"). Its status and message reach the browser.

export const isHttpError = (e: unknown): boolean =>
  typeof e === "object" &&
  e !== null &&
  (e as Record<symbol, unknown>)[Symbol.for("tcm.httpError")] === true

used by