Send the last error for disconnected networks in network status
This adds support for sending the exact error message of a network when it is disconnected, in the reply to the service command `network status`. This lets users easily examine why a network is currently disconnected. No lock is needed because all reads and writes of network.lastError are made in the user goroutine. Closes: https://todo.sr.ht/~emersion/soju/28
This commit is contained in:
parent
eb941d2d2b
commit
8c11205ee6
@ -208,6 +208,9 @@ func handleServiceNetworkStatus(dc *downstreamConn, params []string) error {
|
|||||||
details = fmt.Sprintf("%v channels", len(uc.channels))
|
details = fmt.Sprintf("%v channels", len(uc.channels))
|
||||||
} else {
|
} else {
|
||||||
statuses = append(statuses, "disconnected")
|
statuses = append(statuses, "disconnected")
|
||||||
|
if net.lastError != nil {
|
||||||
|
details = net.lastError.Error()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if net == dc.network {
|
if net == dc.network {
|
||||||
|
Loading…
Reference in New Issue
Block a user