mirror of
https://github.com/writefreely/writefreely
synced 2024-11-24 09:33:11 +00:00
Show correct error when user not found in admin panel
Previously, it would show a 500. This also logs the real reason if it's not a "not found" error
This commit is contained in:
parent
af14bcbb78
commit
666bd1b9d1
1 changed files with 5 additions and 1 deletions
6
admin.go
6
admin.go
|
@ -187,7 +187,11 @@ func handleViewAdminUser(app *App, u *User, w http.ResponseWriter, r *http.Reque
|
|||
var err error
|
||||
p.User, err = app.db.GetUserForAuth(username)
|
||||
if err != nil {
|
||||
return impart.HTTPError{http.StatusInternalServerError, fmt.Sprintf("Could not get user: %v", err)}
|
||||
if err == ErrUserNotFound {
|
||||
return err
|
||||
}
|
||||
log.Error("Could not get user: %v", err)
|
||||
return impart.HTTPError{http.StatusInternalServerError, err.Error()}
|
||||
}
|
||||
|
||||
flashes, _ := getSessionFlashes(app, w, r, nil)
|
||||
|
|
Loading…
Reference in a new issue