fix(core): Error reporter should log all error on an error-chain (no-changelog) (#5342)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-02-03 13:53:51 +01:00 committed by GitHub
parent 6985500a7d
commit 51b560b3f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,8 +12,15 @@ interface ErrorReporter {
}
const instance: ErrorReporter = {
report: (error) =>
error instanceof Error && Logger.error(`${error.constructor.name}: ${error.message}`),
report: (error) => {
if (error instanceof Error) {
let e = error;
do {
Logger.error(`${e.constructor.name}: ${e.message}`);
e = e.cause as Error;
} while (e);
}
},
};
export function init(errorReporter: ErrorReporter) {