refactor(server): dont convert graphql bad request into internal server error (#10203)

This commit is contained in:
fengmk2
2025-02-17 06:17:00 +00:00
parent 34472fdfa9
commit 57213781a8
7 changed files with 66 additions and 9 deletions
@@ -162,12 +162,18 @@ export class TestingApp extends ApplyType<INestApplication>() {
if (res.status !== 200) {
throw new Error(
`Failed to execute gql: ${query}, status: ${res.status}, body: ${JSON.stringify(
res.body
res.body,
null,
2
)}`
);
}
if (res.body.errors?.length) {
if (TEST_LOG_LEVEL !== 'fatal') {
// print the error stack when log level is not fatal, for better debugging
console.error('%o', res.body);
}
throw new Error(res.body.errors[0].message);
}