mirror of https://github.com/veonik/squircy3
Warn on shutdown failure only if connected to irc
parent
f46393ee5b
commit
54a998ca29
|
@ -14,6 +14,8 @@ import (
|
|||
"code.dopame.me/veonik/squircy3/event"
|
||||
)
|
||||
|
||||
var ErrNotConnected = errors.New("not connected")
|
||||
|
||||
type Config struct {
|
||||
Nick string `toml:"nick"`
|
||||
Username string `toml:"user"`
|
||||
|
@ -225,7 +227,7 @@ func (m *Manager) Disconnect() error {
|
|||
conn := m.conn
|
||||
m.mu.RUnlock()
|
||||
if conn == nil {
|
||||
return errors.New("not connected")
|
||||
return ErrNotConnected
|
||||
}
|
||||
return conn.Quit()
|
||||
}
|
||||
|
|
|
@ -66,7 +66,9 @@ func (p *ircPlugin) HandleShutdown() {
|
|||
return
|
||||
}
|
||||
if err := p.manager.Disconnect(); err != nil {
|
||||
logrus.Warnln("irc: failed to disconnect before shutting down:", err)
|
||||
if err != ErrNotConnected {
|
||||
logrus.Warnln("irc: failed to disconnect before shutting down:", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue