From 8038e9f3225ded7ed481898b2b514ab1a7c0087e Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Tue, 9 Mar 2021 14:25:43 +0100 Subject: [PATCH] mobile: gracefully exit if lnd fails to start Instead of killing the app, report an error back to the application. --- mobile/bindings.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mobile/bindings.go b/mobile/bindings.go index aff3c819..4a4b39af 100644 --- a/mobile/bindings.go +++ b/mobile/bindings.go @@ -50,13 +50,15 @@ func Start(extraArgs string, unlockerReady, rpcReady Callback) { loadedConfig, err := lnd.LoadConfig() if err != nil { _, _ = fmt.Fprintln(os.Stderr, err) - os.Exit(1) + rpcReady.OnError(err) + return } // Hook interceptor for os signals. if err := signal.Intercept(); err != nil { _, _ = fmt.Fprintln(os.Stderr, err) - os.Exit(1) + rpcReady.OnError(err) + return } // Set up channels that will be notified when the RPC servers are ready @@ -90,7 +92,8 @@ func Start(extraArgs string, unlockerReady, rpcReady Callback) { } else { fmt.Fprintln(os.Stderr, err) } - os.Exit(1) + rpcReady.OnError(err) + return } }()