* Type guard for error objects with statusCode
(error: unknown)
| 230 | * Type guard for error objects with statusCode |
| 231 | */ |
| 232 | function 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 |
no outgoing calls
no test coverage detected
searching dependent graphs…