Log hot-shots' failed final flush through an unknown value

Programs whose Error subclasses define accessors still compile the shim's
close logging.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Malte Ubl
2026-10-22 05:33:34 -07:00
co-authored by Claude Opus 5.5
parent 8c9f5cfc9f
commit 2e297caf99
+8 -1
View File
@@ -155,6 +155,13 @@ function formatDate(date: number): number {
return Math.round(date);
}
/** console.error of an arbitrary value, as hot-shots logs errors. The
* value crosses as unknown: the typed Error path has no inspect lowering
* in programs whose Error subclasses define accessors. */
function logError(value: unknown): void {
console.error(value);
}
function errorWithCode(message: string, code: string | undefined): Error {
const error: NodeJS.ErrnoException = new Error(message);
error.code = code;
@@ -1013,7 +1020,7 @@ export class StatsD {
this.flushQueue((err) => {
if (err) {
if (callback) return callback(err);
console.error(err);
logError(err);
return;
}
let intervalAttempts = 0;