add the NO_VIABLE_PATH error

This commit is contained in:
Marten Seemann
2020-11-06 12:35:49 +07:00
parent 272229abf0
commit 96ac98a862
3 changed files with 6 additions and 0 deletions

View File

@@ -27,6 +27,7 @@ const (
CryptoBufferExceeded ErrorCode = 0xd
KeyUpdateError ErrorCode = 0xe
AEADLimitReached ErrorCode = 0xf
NoViablePathError ErrorCode = 0x10
)
func (e ErrorCode) isCryptoError() bool {
@@ -83,6 +84,8 @@ func (e ErrorCode) String() string {
return "KEY_UPDATE_ERROR"
case AEADLimitReached:
return "AEAD_LIMIT_REACHED"
case NoViablePathError:
return "NO_VIABLE_PATH"
default:
if e.isCryptoError() {
return fmt.Sprintf("CRYPTO_ERROR (%#x)", uint16(e))

View File

@@ -213,6 +213,8 @@ func (e transportError) String() string {
return "key_update_error"
case qerr.AEADLimitReached:
return "aead_limit_reached"
case qerr.NoViablePathError:
return "no_viable_path"
default:
return ""
}

View File

@@ -121,6 +121,7 @@ var _ = Describe("Types", func() {
Expect(transportError(qerr.InvalidToken).String()).To(Equal("invalid_token"))
Expect(transportError(qerr.ApplicationError).String()).To(Equal("application_error"))
Expect(transportError(qerr.CryptoBufferExceeded).String()).To(Equal("crypto_buffer_exceeded"))
Expect(transportError(qerr.NoViablePathError).String()).To(Equal("no_viable_path"))
Expect(transportError(1337).String()).To(BeEmpty())
})
})