Skip to content
This repository was archived by the owner on Oct 24, 2022. It is now read-only.

Commit a50f182

Browse files
committed
More appropriate error when grpc check fails
1 parent d3ad6a8 commit a50f182

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@synonymdev/react-native-lightning",
33
"title": "React Native Lightning",
4-
"version": "0.0.30",
4+
"version": "0.0.33",
55
"description": "React Native wrapper for Lndmobile",
66
"main": "./dist/index.js",
77
"types": "./dist/index.d.ts",

src/grpc.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,10 @@ class GrpcAction {
2929
* @returns {Promise<void>}
3030
*/
3131
async checkGrpcReady(): Promise<void> {
32-
try {
33-
const state = await this.getStateCommand();
32+
const state = await this.getStateCommand();
3433

35-
if (state === ss_lnrpc.WalletState.WAITING_TO_START) {
36-
throw new Error('LND not started');
37-
}
38-
} catch (e) {
39-
throw new Error('Unable to determine LND state');
34+
if (state === ss_lnrpc.WalletState.WAITING_TO_START) {
35+
throw new Error('LND not started');
4036
}
4137
}
4238

@@ -53,7 +49,7 @@ class GrpcAction {
5349
serialisedReq
5450
);
5551
if (serializedResponse === undefined) {
56-
throw new Error('Missing response');
52+
throw new Error('Unable to determine LND state. Missing response.');
5753
}
5854

5955
return ss_lnrpc.GetStateResponse.decode(base64.toByteArray(serializedResponse)).state;

0 commit comments

Comments
 (0)