1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-09 18:25:58 +01:00

Fix parsing of AddClient error.

NotAuthorisedError may unwrap to os.ErrNotExist.
This commit is contained in:
Juliusz Chroboczek 2024-06-08 14:52:14 +02:00
parent 3e5b5c3033
commit bc512462c7

View file

@ -1424,9 +1424,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
if err != nil { if err != nil {
var e, s string var e, s string
var autherr *group.NotAuthorisedError var autherr *group.NotAuthorisedError
if errors.Is(err, os.ErrNotExist) { if errors.Is(err, token.ErrUsernameRequired) {
s = "group does not exist"
} else if errors.Is(err, token.ErrUsernameRequired) {
s = err.Error() s = err.Error()
e = "need-username" e = "need-username"
} else if errors.Is(err, group.ErrDuplicateUsername) { } else if errors.Is(err, group.ErrDuplicateUsername) {
@ -1436,6 +1434,8 @@ func handleClientMessage(c *webClient, m clientMessage) error {
s = "not authorised" s = "not authorised"
time.Sleep(200 * time.Millisecond) time.Sleep(200 * time.Millisecond)
log.Printf("Join group: %v", err) log.Printf("Join group: %v", err)
} else if errors.Is(err, os.ErrNotExist) {
s = "group does not exist"
} else if _, ok := err.(group.UserError); ok { } else if _, ok := err.(group.UserError); ok {
s = err.Error() s = err.Error()
} else { } else {