rename the constructors for the various qerr.Error flavors

This commit is contained in:
Marten Seemann
2020-03-21 10:53:03 +07:00
parent 2f2583beb0
commit 6d61dccc2f
16 changed files with 69 additions and 69 deletions

View File

@@ -281,7 +281,7 @@ func (h *cryptoSetup) RunHandshake() {
}
func (h *cryptoSetup) onError(alert uint8, message string) {
h.runner.OnError(qerr.CryptoError(alert, message))
h.runner.OnError(qerr.NewCryptoError(alert, message))
}
// Close closes the crypto setup.
@@ -451,7 +451,7 @@ func (h *cryptoSetup) handleMessageForClient(msgType messageType) bool {
func (h *cryptoSetup) handleTransportParameters(data []byte) {
var tp wire.TransportParameters
if err := tp.Unmarshal(data, h.perspective.Opposite()); err != nil {
h.runner.OnError(qerr.Error(qerr.TransportParameterError, err.Error()))
h.runner.OnError(qerr.NewError(qerr.TransportParameterError, err.Error()))
}
h.peerParams = &tp
h.runner.OnReceivedParams(h.peerParams)

View File

@@ -160,7 +160,7 @@ func (a *updatableAEAD) Open(dst, src []byte, rcvTime time.Time, pn protocol.Pac
// This can only occur when the first packet received has key phase 1.
// This is an error, since the key phase starts at 0,
// and peers are only allowed to update keys after the handshake is confirmed.
return nil, qerr.Error(qerr.ProtocolViolation, "wrong initial keyphase")
return nil, qerr.NewError(qerr.ProtocolViolation, "wrong initial keyphase")
}
if a.prevRcvAEAD == nil {
return nil, ErrKeysDropped
@@ -179,7 +179,7 @@ func (a *updatableAEAD) Open(dst, src []byte, rcvTime time.Time, pn protocol.Pac
}
// Opening succeeded. Check if the peer was allowed to update.
if a.firstSentWithCurrentKey == protocol.InvalidPacketNumber {
return nil, qerr.Error(qerr.ProtocolViolation, "keys updated too quickly")
return nil, qerr.NewError(qerr.ProtocolViolation, "keys updated too quickly")
}
a.rollKeys(rcvTime)
a.logger.Debugf("Peer updated keys to %s", a.keyPhase)