mobile: gracefully exit if lnd fails to start

Instead of killing the app, report an error back to the application.
This commit is contained in:
Johan T. Halseth 2021-03-09 14:25:43 +01:00
parent 6dca38c561
commit 8038e9f322
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

@ -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
}
}()