MCPcopy
hub / github.com/FlowiseAI/Flowise / toErrorWithMessage

Function toErrorWithMessage

packages/ui/src/utils/errorHandler.js:5–15  ·  view source on GitHub ↗
(maybeError)

Source from the content-addressed store, hash-verified

3}
4
5const toErrorWithMessage = (maybeError) => {
6 if (isErrorWithMessage(maybeError)) return maybeError
7
8 try {
9 return new Error(JSON.stringify(maybeError))
10 } catch {
11 // fallback in case there's an error stringifying the maybeError
12 // like with circular references for example.
13 return new Error(String(maybeError))
14 }
15}
16
17export const getErrorMessage = (error) => {
18 return toErrorWithMessage(error).message

Callers 1

getErrorMessageFunction · 0.70

Calls 2

stringifyMethod · 0.80
isErrorWithMessageFunction · 0.70

Tested by

no test coverage detected