implement a string representation for crypto error

This commit is contained in:
Marten Seemann
2019-03-07 09:55:55 +09:00
parent ab47ba1021
commit e5303df419
4 changed files with 22 additions and 5 deletions

View File

@@ -25,11 +25,21 @@ var _ = Describe("QUIC Transport Errors", func() {
Expect(err.Error()).To(Equal("NO_ERROR: foobar"))
})
It("has a string representation for crypto errors", func() {
err := CryptoError(42)
Expect(err.Error()).To(Equal("CRYPTO_ERROR 42"))
})
Context("ErrorCode", func() {
It("works as error", func() {
var err error = StreamStateError
Expect(err).To(MatchError("STREAM_STATE_ERROR"))
})
It("recognizes crypto errors", func() {
err := ErrorCode(0x100 + 42)
Expect(err.Error()).To(Equal("CRYPTO_ERROR 42"))
})
})
Context("ToQuicError", func() {