mirror of
https://github.com/renovatebot/renovate.git
synced 2024-12-22 05:28:35 +00:00
22 lines
582 B
TypeScript
22 lines
582 B
TypeScript
import is from '@sindresorhus/is';
|
|
import prepareError from './utils';
|
|
|
|
Error.stackTraceLimit = 20;
|
|
|
|
export default function errSerializer(err: Error): any {
|
|
const response: Record<string, unknown> = prepareError(err);
|
|
|
|
// already done by `sanitizeValue` ?
|
|
const redactedFields = ['message', 'stack', 'stdout', 'stderr'];
|
|
for (const field of redactedFields) {
|
|
const val = response[field];
|
|
if (is.string(val)) {
|
|
response[field] = val.replace(
|
|
/https:\/\/[^@]*?@/g, // TODO #12874
|
|
'https://**redacted**@',
|
|
);
|
|
}
|
|
}
|
|
return response;
|
|
}
|