Merge pull request #2861 from lucas-clemente/no-viable-path-error

add the NO_VIABLE_PATH error
This commit is contained in:
Marten Seemann
2020-11-10 20:50:40 +07:00
committed by GitHub
3 changed files with 6 additions and 0 deletions

View File

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

View File

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

View File

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