MCPcopy Create free account
hub / github.com/dyoshikawa/rulesync / hasStatusCode

Function hasStatusCode

src/lib/fetch.ts:232–238  ·  view source on GitHub ↗

* Type guard for error objects with statusCode

(error: unknown)

Source from the content-addressed store, hash-verified

230 * Type guard for error objects with statusCode
231 */
232function hasStatusCode(error: unknown): error is { statusCode: number } {
233 if (typeof error !== "object" || error === null || !("statusCode" in error)) {
234 return false;
235 }
236 const maybeStatus = Object.getOwnPropertyDescriptor(error, "statusCode")?.value;
237 return typeof maybeStatus === "number";
238}
239
240/**
241 * Check if error is a 404 "not found" error

Callers 1

isNotFoundErrorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…