Replace uses of os.IsExist and os.IsNotExist with errors.Is.
The former don't properly unwrap errors.
This commit is contained in:
@@ -1299,7 +1299,7 @@ func leaveGroup(c *webClient) {
|
||||
|
||||
func closeDownConn(c *webClient, id string, message string) error {
|
||||
err := delDownConn(c, id)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
if err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
log.Printf("Close down connection: %v", err)
|
||||
}
|
||||
err = c.write(clientMessage{
|
||||
@@ -1413,7 +1413,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
|
||||
if err != nil {
|
||||
var e, s string
|
||||
var autherr *group.NotAuthorisedError
|
||||
if os.IsNotExist(err) {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
s = "group does not exist"
|
||||
} else if errors.Is(err, group.ErrAnonymousNotAuthorised) {
|
||||
s = "please choose a username"
|
||||
|
||||
Reference in New Issue
Block a user