1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-25 01:55:57 +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 {
var e, s string
var autherr *group.NotAuthorisedError
if errors.Is(err, os.ErrNotExist) {
s = "group does not exist"
} else if errors.Is(err, token.ErrUsernameRequired) {
if errors.Is(err, token.ErrUsernameRequired) {
s = err.Error()
e = "need-username"
} else if errors.Is(err, group.ErrDuplicateUsername) {
@ -1436,6 +1434,8 @@ func handleClientMessage(c *webClient, m clientMessage) error {
s = "not authorised"
time.Sleep(200 * time.Millisecond)
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 {
s = err.Error()
} else {