MCPcopy Create free account
hub / github.com/pmxt-dev/pmxt / isPlainErrorObject

Function isPlainErrorObject

core/src/utils/error-mapper.ts:31–40  ·  view source on GitHub ↗

Type guard for plain error objects with numeric status codes.

(value: unknown)

Source from the content-addressed store, hash-verified

29
30/** Type guard for plain error objects with numeric status codes. */
31function isPlainErrorObject(value: unknown): value is PlainErrorObject {
32 return (
33 typeof value === 'object' &&
34 value !== null &&
35 !Array.isArray(value) &&
36 !(value instanceof Error) &&
37 'status' in value &&
38 typeof (value as PlainErrorObject).status === 'number'
39 );
40}
41
42/**
43 * An Error subclass with optional HTTP metadata attached by third-party SDKs.

Callers 2

mapErrorMethod · 0.85
extractErrorMessageMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected