Skip to content

Commit

Permalink
fix: error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
iGroza committed Mar 18, 2024
1 parent 8803d94 commit 31c42ba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"react-native-ble-plx": "*"
},
"devDependencies": {
"@haqq/provider-base": "0.0.22",
"@haqq/provider-base": "0.0.23",
"@ledgerhq/types-devices": "^6.23.0",
"@types/jest": "^29.4.0",
"@types/node": "^18.14.1",
Expand Down
8 changes: 4 additions & 4 deletions src/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,22 +276,22 @@ export class ProviderLedgerReactNative
}

catchError(e: Error, source: string) {
this.emit('error', e, source);
let handled = false;
switch (e.name) {
case 'TransportStatusError':
// @ts-ignore
switch (String(e.statusCode)) {
case '27010':
handled = true;
this.emit(source, false, e.message, e.name, '27010');
throw new Error('ledger_locked');
case '27013':
handled = true;
this.emit(source, false, e.message, e.name, '27013');
throw new Error('ledger_rejected');
}
break;
default:
super.catchError(e, source);
break;
}
super.catchError(e, source, handled);
}
}
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1184,10 +1184,10 @@
dependencies:
"@hapi/hoek" "^9.0.0"

"@haqq/[email protected].22":
version "0.0.22"
resolved "https://registry.yarnpkg.com/@haqq/provider-base/-/provider-base-0.0.22.tgz#04ec83a52b7fbbf85e28914950cd484498937664"
integrity sha512-RjHhmNroC8kV29u2yjuTpgH0Cy0z425exzcMCXYXsV2z+NHxPptNA2W/hzXejMh6HV03BqnGEfWGBu4cCorniQ==
"@haqq/[email protected].23":
version "0.0.23"
resolved "https://registry.yarnpkg.com/@haqq/provider-base/-/provider-base-0.0.23.tgz#236fb9582e4c385fa12a6f2391b7a13d9abc010b"
integrity sha512-azatdWYFK/vS5OMtFslsHt0MXrQumX3TIk/tjcQulhDFkUngDqderHttNMueC0NU0yPWMg2ot/Za+q6VvG5tWg==
dependencies:
bech32-converting "^1.0.9"
ethers "^5.7.2"
Expand Down

0 comments on commit 31c42ba

Please sign in to comment.