refactor: centralize unhandled rejection setup

This commit is contained in:
Peter Steinberger
2026-01-07 20:59:49 +00:00
parent fd3babc626
commit 9bd439892f
7 changed files with 43 additions and 45 deletions

14
src/infra/bonjour-ciao.ts Normal file
View File

@@ -0,0 +1,14 @@
import { logDebug } from "../logger.js";
import { formatBonjourError } from "./bonjour-errors.js";
export function ignoreCiaoCancellationRejection(reason: unknown): boolean {
const message = formatBonjourError(reason).toUpperCase();
if (!message.includes("CIAO ANNOUNCEMENT CANCELLED")) {
return false;
}
logDebug(
`bonjour: ignoring unhandled ciao rejection: ${formatBonjourError(reason)}`,
);
return true;
}