Skip to content

Commit

Permalink
fix: display actual error message
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKheops committed Jan 6, 2025
1 parent cff0db1 commit 4ca65c1
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions apps/extension/src/ui/hooks/ledger/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,11 @@ export const getTalismanLedgerError = (error: unknown, appName: string): Talisma
// eslint-disable-next-line no-console
DEBUG && console.warn("unmanaged ledger error", { error })

return new TalismanLedgerError(
"Unknown",
// this will attempt to display relevant info about the error, useful if users ask for help with a screenshot.
t(
"[{{label}}] Failed to connect to your Ledger. Make sure <strong>{{appName}}</strong> app is open and try again. {{message}}",
{
label: cause.name ?? cause.returnCode ?? cause.statusCode,
message: cause.message,
appName: capitalize(appName),
},
),
{ cause },
)
// At this point either the error most likely not a Ledger error (custom Talisman message) or it is an error that we don't manage
// either way, we want to display the original error message
return new TalismanLedgerError("Unknown", cause.message ?? "Failed to connect to your Ledger", {
cause,
})
}

const getErrorFromCode = (code: number | undefined, appName: string, cause: unknown) => {
Expand Down

0 comments on commit 4ca65c1

Please sign in to comment.