diff --git a/packages/backend/src/graphql/mutations/execute-flow.ts b/packages/backend/src/graphql/mutations/execute-flow.ts index f9eb3740..063259af 100644 --- a/packages/backend/src/graphql/mutations/execute-flow.ts +++ b/packages/backend/src/graphql/mutations/execute-flow.ts @@ -34,7 +34,7 @@ const executeFlow = async ( }); if (executionStep.errorDetails) { - throw new Error(JSON.stringify(executionStep.errorDetails, null, 2)); + throw new Error(JSON.stringify(executionStep.errorDetails)); } return { data: executionStep.dataOut, step: untilStep }; diff --git a/packages/web/src/components/TestSubstep/index.tsx b/packages/web/src/components/TestSubstep/index.tsx index c03b2b0b..88beec63 100644 --- a/packages/web/src/components/TestSubstep/index.tsx +++ b/packages/web/src/components/TestSubstep/index.tsx @@ -25,6 +25,19 @@ type TestSubstepProps = { step: IStep; }; +function serializeErrors(graphQLErrors: any) { + return graphQLErrors?.map((error: Record) => { + try { + return { + ...error, + message: (
{JSON.stringify(JSON.parse(error.message as string), null, 2)}
), + } + } catch { + return error; + } + }) +} + function TestSubstep(props: TestSubstepProps): React.ReactElement { const { substep, @@ -81,7 +94,7 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement { {error?.graphQLErrors?.length && - {error?.graphQLErrors.map((error) => (<>{error.message}
))} + {serializeErrors(error.graphQLErrors).map((error: any) => (
{error.message}
))}
} {hasNoOutput && ( diff --git a/packages/web/src/graphql/link.ts b/packages/web/src/graphql/link.ts index 546df7dd..f8d0dd0f 100644 --- a/packages/web/src/graphql/link.ts +++ b/packages/web/src/graphql/link.ts @@ -49,7 +49,7 @@ const createErrorLink = (callback: CreateLinkOptions['onError']): ApolloLink => }); // eslint-disable-next-line @typescript-eslint/no-empty-function -const noop = () => {}; +const noop = () => { }; const createLink = (options: CreateLinkOptions): ApolloLink => { const {