aboutsummaryrefslogtreecommitdiffhomepage
path: root/system
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-30 16:51:40 +0900
committerOphestra <cat@gensokyo.uk>2025-08-30 16:51:40 +0900
commitb12c290f12ab65754d6ce8a461fe641e245cb09c (patch)
tree84b56bd61c58d8cbd15e134f7c1d2ccb3838bdd3 /system
parent0122593312679f193e8c2574abf9ae879173d185 (diff)
system/wayland: improve error descriptions
A lot of these errors have very short and nondescript descriptions. These are only returned on incorrect API usage, but it makes sense to make them more descriptive anyway. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system')
-rw-r--r--system/wayland/conn.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/system/wayland/conn.go b/system/wayland/conn.go
index a930fc01..86e0a288 100644
--- a/system/wayland/conn.go
+++ b/system/wayland/conn.go
@@ -10,6 +10,7 @@ import (
"syscall"
)
+// Conn represents a connection to the wayland display server.
type Conn struct {
conn *net.UnixConn
@@ -25,7 +26,7 @@ func (c *Conn) Attach(p string) (err error) {
defer c.mu.Unlock()
if c.conn != nil {
- return errors.New("attached")
+ return errors.New("socket already attached")
}
c.conn, err = net.DialUnix("unix", nil, &net.UnixAddr{Name: p, Net: "unix"})
@@ -51,15 +52,16 @@ func (c *Conn) Close() error {
return nil
}
-func (c *Conn) Bind(p, appID, instanceID string) (*os.File, error) {
+// Bind binds the new socket to pathname.
+func (c *Conn) Bind(pathname, appID, instanceID string) (*os.File, error) {
c.mu.Lock()
defer c.mu.Unlock()
if c.conn == nil {
- return nil, errors.New("not attached")
+ return nil, errors.New("socket not attached")
}
if c.done != nil {
- return nil, errors.New("bound")
+ return nil, errors.New("socket already bound")
}
if rc, err := c.conn.SyscallConn(); err != nil {
@@ -67,7 +69,7 @@ func (c *Conn) Bind(p, appID, instanceID string) (*os.File, error) {
return nil, err
} else {
c.done = make(chan struct{})
- return bindRawConn(c.done, rc, p, appID, instanceID)
+ return bindRawConn(c.done, rc, pathname, appID, instanceID)
}
}