move all error things to new qerr package, replacing errorcodes

This commit is contained in:
Lucas Clemente
2016-05-17 10:24:34 +02:00
parent 62da35d613
commit bfaa4200df
12 changed files with 71 additions and 66 deletions

View File

@@ -3,8 +3,8 @@ package frames
import (
"bytes"
"github.com/lucas-clemente/quic-go/errorcodes"
"github.com/lucas-clemente/quic-go/protocol"
"github.com/lucas-clemente/quic-go/qerr"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -15,7 +15,7 @@ var _ = Describe("ConnectionCloseFrame", func() {
b := bytes.NewReader([]byte{0x40, 0x19, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x4e, 0x6f, 0x20, 0x72, 0x65, 0x63, 0x65, 0x6e, 0x74, 0x20, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x2e})
frame, err := ParseConnectionCloseFrame(b)
Expect(err).ToNot(HaveOccurred())
Expect(frame.ErrorCode).To(Equal(errorcodes.ErrorCode(0x19)))
Expect(frame.ErrorCode).To(Equal(qerr.ErrorCode(0x19)))
Expect(frame.ReasonPhrase).To(Equal("No recent network activity."))
Expect(b.Len()).To(Equal(0))
})
@@ -24,7 +24,7 @@ var _ = Describe("ConnectionCloseFrame", func() {
b := bytes.NewReader([]byte{0x02, 0xAD, 0xFB, 0xCA, 0xDE, 0x00, 0x00})
frame, err := ParseConnectionCloseFrame(b)
Expect(err).ToNot(HaveOccurred())
Expect(frame.ErrorCode).To(Equal(errorcodes.ErrorCode(0xDECAFBAD)))
Expect(frame.ErrorCode).To(Equal(qerr.ErrorCode(0xDECAFBAD)))
Expect(frame.ReasonPhrase).To(BeEmpty())
Expect(b.Len()).To(Equal(0))
})