api clients: return data, error, no status
jellyseerr already did this, but it's been standardised a little more. Mediabrowser uses it's own genericErr function and error types due to being a separate package, while jellyseerr and ombi now share errors defined in common/.
This commit is contained in:
@@ -91,19 +91,22 @@ func (app *appContext) TestJF(gc *gin.Context) {
|
||||
tempjf.SetTransport(transport)
|
||||
}
|
||||
|
||||
user, status, err := tempjf.Authenticate(req.Username, req.Password)
|
||||
if !(status == 200 || status == 204) || err != nil {
|
||||
user, err := tempjf.Authenticate(req.Username, req.Password)
|
||||
if err != nil {
|
||||
msg := ""
|
||||
switch status {
|
||||
case 0:
|
||||
msg = "errorConnectionRefused"
|
||||
status = 500
|
||||
case 401:
|
||||
status := 500
|
||||
switch err.(type) {
|
||||
case mediabrowser.ErrUnauthorized:
|
||||
msg = "errorInvalidUserPass"
|
||||
case 403:
|
||||
status = 401
|
||||
case mediabrowser.ErrForbidden:
|
||||
msg = "errorUserDisabled"
|
||||
case 404:
|
||||
status = 403
|
||||
case mediabrowser.ErrNotFound:
|
||||
msg = "error404"
|
||||
status = 404
|
||||
default:
|
||||
msg = "errorConnectionRefused"
|
||||
}
|
||||
app.err.Printf(lm.FailedAuthJellyfin, req.Server, status, err)
|
||||
if msg != "" {
|
||||
|
||||
Reference in New Issue
Block a user