Add sensible defaults to error switches

This commit is contained in:
some 2024-10-01 22:01:54 -04:00
parent 8162189c27
commit fb4a2010d6
Signed by: some
GPG Key ID: 65D0589220B9BFC8
2 changed files with 8 additions and 0 deletions

View File

@ -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
}

View File

@ -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
}