Fix tests.

This commit is contained in:
Sam Rose 2024-07-04 09:55:36 +01:00
parent 4f01cb50cd
commit 16e293a9ff
No known key found for this signature in database
2 changed files with 6 additions and 5 deletions

View File

@ -23,11 +23,6 @@ export async function errorHandling(ctx: any, next: any) {
error: errors.getPublicError(err),
}
if (environment.isTest() && ctx.headers["x-budibase-include-stacktrace"]) {
// @ts-ignore
error.stack = err.stack
}
if (stringContainsSecret(JSON.stringify(error))) {
error = {
message: "Unexpected error",
@ -36,6 +31,11 @@ export async function errorHandling(ctx: any, next: any) {
}
}
if (environment.isTest() && ctx.headers["x-budibase-include-stacktrace"]) {
// @ts-ignore
error.stack = err.stack
}
ctx.body = error
}
}

View File

@ -12,6 +12,7 @@ export function stringContainsSecret(str: string) {
}
if (str.includes(value)) {
throw new Error(`String contains secret: ${key}=${value}`)
return true
}
}