Logos Kit

Handle errors

Which errors to show, which to ignore, and how to recover.

Every rejection is a LezError: { code, message, data? }. Most need one of four responses.

SituationCodesDo
The user said no4001Show nothing. kit.sdk.isUserRejection(e)
The wallet is still busy6107, 6108Say "Waiting for your wallet"; see slow approvals
Access changed4100, 4900, 4902Ask to connect again, unlock, or switch network
The chain moved or refused6106, 6102, 6103Propose again (fresh state)
function show(e) {
    if (kit.sdk.isUserRejection(e)) return
    switch (e.code) {
    case kit.sdk.ErrorCode.Timeout:      root.phase = "waiting"; return
    case kit.sdk.ErrorCode.Unauthorized: root.session = null; root.hint = "Connect again"; return
    default:                             root.error = e.message
    }
}

Show the wallet's message as plain text (textFormat: Text.PlainText). The UI kit's Txt does that by default.

A transaction that lands but fails isn't a rejection: it resolves, then its status ends included with outcome: "failure". See Send a transaction.

Every code is listed in Error codes.