refactor: dedupe infra lowercase helpers

This commit is contained in:
Peter Steinberger
2026-04-07 15:36:33 +01:00
parent ddde144cb6
commit 761e12008d
8 changed files with 31 additions and 28 deletions

View File

@@ -9,6 +9,7 @@ import {
} from "../infra/device-pairing.js";
import { formatTimeAgo } from "../infra/format-time/format-relative.ts";
import { defaultRuntime } from "../runtime.js";
import { normalizeLowercaseStringOrEmpty } from "../shared/string-coerce.js";
import { getTerminalTableWidth, renderTable } from "../terminal/table.js";
import { theme } from "../terminal/theme.js";
import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js";
@@ -100,7 +101,7 @@ function normalizeErrorMessage(error: unknown): string {
}
function shouldUseLocalPairingFallback(opts: DevicesRpcOpts, error: unknown): boolean {
const message = normalizeErrorMessage(error).toLowerCase();
const message = normalizeLowercaseStringOrEmpty(normalizeErrorMessage(error));
if (!message.includes("pairing required")) {
return false;
}