mirror of
https://github.com/block/buzz.git
synced 2026-10-31 06:21:34 +00:00
## Summary - Replace all references to a specific corporate VPN product name with generic "VPN" / "corporate VPN" / "VPN tunnel" / "VPN CLI" language across 15 files (21 lines) - Comment-only and doc-only changes — zero functional impact - Keeps the OSS repo free of vendor-specific assumptions `rg -i warp` returns zero hits after this change (excluding `node_modules`, lockfiles).
35 lines
1.4 KiB
TypeScript
35 lines
1.4 KiB
TypeScript
/**
|
|
* Utilities for classifying relay connectivity errors.
|
|
*
|
|
* The Rust backend (`desktop/src-tauri/src/relay.rs`) prefixes every
|
|
* "relay unreachable" error message with this literal string so that the
|
|
* frontend can distinguish a transient connectivity failure (e.g. corporate VPN
|
|
* needs reauth, Cloudflare Access 403) from an application-level error.
|
|
*
|
|
* Contract: the Rust layer MUST emit errors starting with exactly this prefix
|
|
* for any condition where the relay host is unreachable at the network or
|
|
* auth layer. Do not change this string without updating relay.rs in lockstep.
|
|
*/
|
|
const RELAY_UNREACHABLE_PREFIX = "relay unreachable:";
|
|
|
|
export const RELAY_UNREACHABLE_SHORT = "Can't reach the relay.";
|
|
export const RELAY_UNREACHABLE_MESSAGE =
|
|
"Can't reach the relay — check your VPN or network connection.";
|
|
|
|
/**
|
|
* Returns true when `error` carries the stable Rust-layer prefix indicating
|
|
* the relay is unreachable (network failure, VPN reauth needed, etc.).
|
|
*
|
|
* Accepts both `Error` instances and raw strings so callers can pass whatever
|
|
* the Tauri IPC or WebSocket layer hands them without pre-normalizing.
|
|
*/
|
|
export function isRelayUnreachableError(error: unknown): boolean {
|
|
if (error instanceof Error) {
|
|
return error.message.startsWith(RELAY_UNREACHABLE_PREFIX);
|
|
}
|
|
if (typeof error === "string") {
|
|
return error.startsWith(RELAY_UNREACHABLE_PREFIX);
|
|
}
|
|
return false;
|
|
}
|