From 9bfb8224cd79cbc67b80c0d3341f76818de82e73 Mon Sep 17 00:00:00 2001 From: Max Kaplan Date: Sun, 17 Feb 2019 15:09:15 -0500 Subject: [PATCH] lncli: returning non 0 exit code when paying invoice fails --- cmd/lncli/commands.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/lncli/commands.go b/cmd/lncli/commands.go index a11b59fa..419ecb45 100644 --- a/cmd/lncli/commands.go +++ b/cmd/lncli/commands.go @@ -2176,6 +2176,13 @@ func sendPaymentRequest(client lnrpc.LightningClient, req *lnrpc.SendRequest) er R: resp.PaymentRoute, }) + // If we get a payment error back, we pass an error + // up to main which eventually calls fatal() and returns + // with a non-zero exit code. + if resp.PaymentError != "" { + return errors.New(resp.PaymentError) + } + return nil }