From 8312b46f144cc1bcf5b6838854df2a9b167c1c3a Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Thu, 22 Feb 2024 20:25:14 -0500 Subject: ipc: improve error handling Detect error responses in addition to errors connecting, sending the request, and receiving the response. If an error occurs when retrying the IPC call, keep the new aerc instance running and simply show the error. We already know (due to the initial failed IPC call) that no other aerc instance is running. Keeping the new instance open also improves the visibility of the error in some cases, such as when clicking on a malformed mailto link causes a new aerc instance to open. Signed-off-by: Jason Cox Acked-by: Robin Jarry --- lib/ipc/receive.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/ipc/receive.go') diff --git a/lib/ipc/receive.go b/lib/ipc/receive.go index 79618f50..4f6258ad 100644 --- a/lib/ipc/receive.go +++ b/lib/ipc/receive.go @@ -27,7 +27,7 @@ type AercServer struct { func StartServer(handler Handler, startup context.Context) (*AercServer, error) { sockpath := xdg.RuntimePath("aerc.sock") // remove the socket if it is not connected to a session - if err := ConnectAndExec(nil); err != nil { + if _, err := ConnectAndExec(nil); err != nil { os.Remove(sockpath) } log.Debugf("Starting Unix server: %s", sockpath) -- cgit