forked from quic-go/quic-go
improve string representation of timeout errors
This commit is contained in:
@@ -65,9 +65,14 @@ func (e *QuicError) Error() string {
|
||||
}
|
||||
return fmt.Sprintf("Application error %#x: %s", uint64(e.ErrorCode), e.ErrorMessage)
|
||||
}
|
||||
str := e.ErrorCode.String()
|
||||
if e.FrameType != 0 {
|
||||
str += fmt.Sprintf(" (frame type: %#x)", e.FrameType)
|
||||
var str string
|
||||
if e.isTimeout {
|
||||
str = "Timeout"
|
||||
} else {
|
||||
str = e.ErrorCode.String()
|
||||
if e.FrameType != 0 {
|
||||
str += fmt.Sprintf(" (frame type: %#x)", e.FrameType)
|
||||
}
|
||||
}
|
||||
msg := e.ErrorMessage
|
||||
if len(msg) == 0 {
|
||||
|
||||
@@ -33,7 +33,7 @@ var _ = Describe("QUIC Transport Errors", func() {
|
||||
It("has a string representation for timeout errors", func() {
|
||||
err := NewTimeoutError("foobar")
|
||||
Expect(err.Timeout()).To(BeTrue())
|
||||
Expect(err.Error()).To(Equal("NO_ERROR: foobar"))
|
||||
Expect(err.Error()).To(Equal("Timeout: foobar"))
|
||||
})
|
||||
|
||||
Context("crypto errors", func() {
|
||||
|
||||
Reference in New Issue
Block a user