From 674a4675a10ea7eb83fad2eada5bf7211c7575f3 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Mon, 25 Jan 2021 09:21:51 -0800 Subject: device: introduce new IPC error message for unknown error Signed-off-by: Josh Bleecher Snyder --- device/uapi.go | 4 ++-- ipc/uapi_unix.go | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/device/uapi.go b/device/uapi.go index 90a9952..424fbfb 100644 --- a/device/uapi.go +++ b/device/uapi.go @@ -427,8 +427,8 @@ func (device *Device) IpcHandle(socket net.Conn) { // write status var status *IPCError if err != nil && !errors.As(err, &status) { - // I/O error, maybe something unexpected - status = ipcErrorf(1, "other UAPI error: %w", err) + // shouldn't happen + status = ipcErrorf(ipc.IpcErrorUnknown, "other UAPI error: %w", err) } if status != nil { device.log.Error.Println(status) diff --git a/ipc/uapi_unix.go b/ipc/uapi_unix.go index 510ab31..9074fd9 100644 --- a/ipc/uapi_unix.go +++ b/ipc/uapi_unix.go @@ -21,6 +21,7 @@ const ( IpcErrorProtocol = -int64(unix.EPROTO) IpcErrorInvalid = -int64(unix.EINVAL) IpcErrorPortInUse = -int64(unix.EADDRINUSE) + IpcErrorUnknown = -55 // ENOANO ) // socketDirectory is variable because it is modified by a linker -- cgit v1.2.3