From 70186d2b2745d19c5056fe0cc3417611bd508cff Mon Sep 17 00:00:00 2001 From: Harshit933 Date: Wed, 12 Jul 2023 21:29:34 +0530 Subject: [PATCH] fix : fixes the parsing of json to throw exception. The json received in case of any error is of the type `{error: {code: -32602, message: This payment is destined for ourselves. Self-payments are not supported}, id: (null)commando:pay#106, jsonrpc: 2.0}`. For now the exceptions are thrown by checking if it contains the `errors` key. But it should be `error` as mentioned in the above response. --- packages/lnlambda/lib/src/lnlambda_base.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lnlambda/lib/src/lnlambda_base.dart b/packages/lnlambda/lib/src/lnlambda_base.dart index d899e46..0a29ad2 100644 --- a/packages/lnlambda/lib/src/lnlambda_base.dart +++ b/packages/lnlambda/lib/src/lnlambda_base.dart @@ -58,7 +58,7 @@ class LNLambdaClient implements LightningClient { }, body: json.encode(request.toJSON())); Map result = json.decode(response.body); - if (result.containsKey("errors")) { + if (result.containsKey("error")) { throw Exception(response.body); } return result["result"];