syncServerRefusalCopy function
- WalletLocalizations l10n,
- WalletApiError error, {
- required bool typedAddress,
The copy for a switch/probe REFUSAL, by KIND — never by message text (the FFI rule). Unknown kinds fall to the unreachable copy: the honest generic ("couldn't reach this server") over a silent no-op.
typedAddress splits the unreachable arm, and stage S1 copy is why. That
arm is the CATCH-ALL: probe_oracle maps everything that is not a FAILED
private dial onto syncServerUnreachable, and since stage S1 a private
path that ACCEPTS the dial and then carries nothing no longer reports
TorUnavailable — deliberately, because blaming the path for what the
evidence cannot separate from a wedged server is the over-claim the stage
removed. So a censored path and a wedged server arrive here as the same
error, and the SDK genuinely cannot tell them apart. One sentence cannot
serve both readers: for a user who just TYPED an address, "check the
address" is the right first step; for a server the APP offered, the address
is not theirs to check and that step is dead advice. Each sentence names
the causes it cannot choose between and gives a step the reader can
actually take.
Implementation
String syncServerRefusalCopy(
WalletLocalizations l10n,
WalletApiError error, {
required bool typedAddress,
}) => switch (error.kind) {
// The private path is GENUINELY down (a dial that failed, nothing
// registered, a FAILED descriptor): the honest word is the path's, never
// "check the address" — the same copy the sync badge uses.
WalletErrorKind_Sync(:final stall) when stall == StallReason.torUnavailable =>
l10n.walletStallTor,
WalletErrorKind_NetworkMismatch() => l10n.walletSyncServerWrongNetwork,
WalletErrorKind_InvalidEndpoint() => l10n.walletSyncServerInvalidUrl,
// ADR-0568: a key or header the door refused — the key's copy, never the
// address's (the user typed both; only the kind tells them which to fix).
WalletErrorKind_InvalidEndpointAuth() => l10n.walletSyncServerKeyInvalid,
WalletErrorKind_SyncServerNotOffered() => l10n.walletSyncServerNotOffered,
WalletErrorKind_WalletBusy() => l10n.walletSyncServerBusy,
_ =>
typedAddress
? l10n.walletSyncServerUnreachable
: l10n.walletSyncServerUnreachableOffered,
};