mirror of
https://github.com/tinygo-org/net.git
synced 2026-07-26 08:18:39 +00:00
add ErrClosed error type for natiu-mqtt
This commit is contained in:
committed by
deadprogram
parent
6bb697535a
commit
1b87eff727
@@ -197,3 +197,27 @@ func (e *AddrError) Error() string {
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
// errNetClosing is the type of the variable ErrNetClosing.
|
||||
// This is used to implement the net.Error interface.
|
||||
type errNetClosing struct{}
|
||||
|
||||
// Error returns the error message for ErrNetClosing.
|
||||
// Keep this string consistent because of issue #4373:
|
||||
// since historically programs have not been able to detect
|
||||
// this error, they look for the string.
|
||||
func (e errNetClosing) Error() string { return "use of closed network connection" }
|
||||
|
||||
func (e errNetClosing) Timeout() bool { return false }
|
||||
func (e errNetClosing) Temporary() bool { return false }
|
||||
|
||||
// errClosed exists just so that the docs for ErrClosed don't mention
|
||||
// the internal package poll.
|
||||
var errClosed = errNetClosing{}
|
||||
|
||||
// ErrClosed is the error returned by an I/O call on a network
|
||||
// connection that has already been closed, or that is closed by
|
||||
// another goroutine before the I/O is completed. This may be wrapped
|
||||
// in another error, and should normally be tested using
|
||||
// errors.Is(err, net.ErrClosed).
|
||||
var ErrClosed error = errClosed
|
||||
|
||||
Reference in New Issue
Block a user