From fb4a2010d61631db4b24f077720bae1ee63a0a3d Mon Sep 17 00:00:00 2001 From: some Date: Tue, 1 Oct 2024 22:01:54 -0400 Subject: [PATCH] Add sensible defaults to error switches --- server/callback.go | 4 ++++ server/token.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/server/callback.go b/server/callback.go index 1481f6f..8aead36 100644 --- a/server/callback.go +++ b/server/callback.go @@ -33,6 +33,8 @@ func (ce CallbackError) HttpStatus() (code int) { code = http.StatusUnauthorized case CallbackErrorServerError: code = http.StatusInternalServerError + default: + code = http.StatusInternalServerError } return } @@ -47,6 +49,8 @@ func (ce CallbackError) String() (out string) { out = "user unauthorized" case CallbackErrorServerError: out = "internal server error" + default: + out = "unhandled error" } return } diff --git a/server/token.go b/server/token.go index cf87b49..d66b017 100644 --- a/server/token.go +++ b/server/token.go @@ -39,6 +39,8 @@ func (te TokenError) HttpStatus() (code int) { code = http.StatusBadRequest case TokenErrorPending: code = http.StatusBadRequest + default: + code = http.StatusInternalServerError } return } @@ -57,6 +59,8 @@ func (te TokenError) String() (out string) { out = "slow down" case TokenErrorPending: out = "authorization pending" + default: + out = "unhandled error" } return }