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

Function errorToString

src/helper/errors.ts:21–31  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

19 )
20}
21export const errorToString = (error: unknown): string => {
22 if (typeof error === 'string') {
23 return error
24 } else if (error instanceof Error) {
25 return error.message
26 } else if (isAPIError(error)) {
27 return error.data.error.message
28 } else {
29 return 'An unknown error occurred'
30 }
31}

Callers 3

ThreadGPTFunction · 0.90
ModelSelectorFunction · 0.90
ErrorTabFunction · 0.90

Calls 1

isAPIErrorFunction · 0.85

Tested by

no test coverage detected