Use constant error for Sessions

This commit is contained in:
Ola
2022-09-13 16:08:13 +02:00
parent f27c82fac5
commit b10d057bd5
+1 -1
View File
@@ -277,7 +277,7 @@ func (m *Melody) BroadcastBinaryOthers(msg []byte, s *Session) error {
// Sessions returns all sessions. An error is returned if the melody session is closed.
func (m *Melody) Sessions() ([]*Session, error) {
if m.hub.closed() {
return nil, errors.New("melody instance is closed")
return nil, ErrClosed
}
return m.hub.all(), nil
}