MCPcopy Create free account
hub / github.com/dtinth/ThreadGPT / isAPIError

Function isAPIError

src/helper/errors.ts:8–20  ·  view source on GitHub ↗
(error: APIError | unknown)

Source from the content-addressed store, hash-verified

6 }
7}
8const isAPIError = (error: APIError | unknown): error is APIError => {
9 return (
10 typeof error === 'object' &&
11 error !== null &&
12 'data' in error &&
13 typeof error.data === 'object' &&
14 error.data !== null &&
15 'error' in error.data &&
16 typeof error.data.error === 'object' &&
17 error.data.error !== null &&
18 'message' in error.data.error
19 )
20}
21export const errorToString = (error: unknown): string => {
22 if (typeof error === 'string') {
23 return error

Callers 1

errorToStringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected