Skip to content

Commit

Permalink
feat: add updated error message to invalid data (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
rozanagy authored Oct 23, 2024
1 parent 370bda9 commit 2d0c747
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@ interface LedgerModalErrorBoxProps {
}

function formatErrorMessage(error: string): string {
if (error.includes('0x6985')) {
return 'Action Rejected by User';
} else if (error.includes('0x5515')) {
return 'Locked Device';
} else {
return error;
const errorMessages: Record<string, string> = {
'0x6985': 'Action Rejected by User',
'0x5515': 'Locked Device',
'0x6a80':
"Invalid data received. Please ensure your Ledger hardware's firmware and Bitcoin app are up to date",
};

for (const [code, message] of Object.entries(errorMessages)) {
if (error.includes(code)) {
return message;
}
}
return error;
}

export function LedgerModalErrorBox({
Expand Down

0 comments on commit 2d0c747

Please sign in to comment.