Add sensible defaults to error switches
This commit is contained in:
parent
8162189c27
commit
fb4a2010d6
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user