Fix tests.
This commit is contained in:
parent
4f01cb50cd
commit
16e293a9ff
|
@ -23,11 +23,6 @@ export async function errorHandling(ctx: any, next: any) {
|
||||||
error: errors.getPublicError(err),
|
error: errors.getPublicError(err),
|
||||||
}
|
}
|
||||||
|
|
||||||
if (environment.isTest() && ctx.headers["x-budibase-include-stacktrace"]) {
|
|
||||||
// @ts-ignore
|
|
||||||
error.stack = err.stack
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stringContainsSecret(JSON.stringify(error))) {
|
if (stringContainsSecret(JSON.stringify(error))) {
|
||||||
error = {
|
error = {
|
||||||
message: "Unexpected 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
|
ctx.body = error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ export function stringContainsSecret(str: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str.includes(value)) {
|
if (str.includes(value)) {
|
||||||
|
throw new Error(`String contains secret: ${key}=${value}`)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue