forked from quic-go/quic-go
Merge pull request #1805 from lucas-clemente/return-timeout-errors
consistently return timeout errors after timeouts
This commit is contained in:
@@ -2,6 +2,7 @@ package qerr
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
// ErrorCode can be used as a normal error without reason.
|
||||
@@ -17,6 +18,8 @@ type QuicError struct {
|
||||
ErrorMessage string
|
||||
}
|
||||
|
||||
var _ net.Error = &QuicError{}
|
||||
|
||||
// Error creates a new QuicError instance
|
||||
func Error(errorCode ErrorCode, errorMessage string) *QuicError {
|
||||
return &QuicError{
|
||||
@@ -29,6 +32,11 @@ func (e *QuicError) Error() string {
|
||||
return fmt.Sprintf("%s: %s", e.ErrorCode.String(), e.ErrorMessage)
|
||||
}
|
||||
|
||||
// Temporary says if the error is temporary.
|
||||
func (e *QuicError) Temporary() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Timeout says if this error is a timeout.
|
||||
func (e *QuicError) Timeout() bool {
|
||||
switch e.ErrorCode {
|
||||
|
||||
Reference in New Issue
Block a user