Skip to content

Commit

Permalink
fix: catch the exception in the ping API
Browse files Browse the repository at this point in the history
Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
  • Loading branch information
vincenzopalazzo committed Aug 19, 2022
1 parent f7d91e7 commit 2a244c5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions api/LNSocketAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,11 @@ export default class LNSocketAPI implements AppAPI {
}

async ping(node_id: string): Promise<boolean> {
let response: any = await this.call("ping", { id: node_id });
if (response.error == null) {
try {
let response: any = await this.call("ping", { id: node_id });
return true;
} else {
} catch (error) {
console.log(error);
return false;
}
}
Expand All @@ -143,7 +144,7 @@ export default class LNSocketAPI implements AppAPI {
.query({
query: gql`
query {
getMetricOneResult(network: "${network}",
getMetricOneResult(network: "${network}",
node_id: "${nodeId}") {
version
age
Expand Down Expand Up @@ -216,7 +217,7 @@ export default class LNSocketAPI implements AppAPI {
}
}
}
}
}
`,
})
.then((result: any) => {
Expand Down

0 comments on commit 2a244c5

Please sign in to comment.