refactor(errors): handle api / app errors better
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-26 22:07:30 -05:00
parent fd8b6bcdc1
commit 8c4c1022c3
6 changed files with 316 additions and 239 deletions

View File

@@ -135,7 +135,7 @@ func (api *API) authAdminWebAppMiddleware(c *gin.Context) {
}
}
errorPage(c, http.StatusUnauthorized, "Admin Permissions Required")
appErrorPage(c, http.StatusUnauthorized, "Admin Permissions Required")
c.Abort()
return
}
@@ -175,7 +175,7 @@ func (api *API) appAuthFormLogin(c *gin.Context) {
func (api *API) appAuthFormRegister(c *gin.Context) {
if !api.Config.RegistrationEnabled {
errorPage(c, http.StatusUnauthorized, "Nice try. Registration is disabled.")
appErrorPage(c, http.StatusUnauthorized, "Nice try. Registration is disabled.")
return
}
@@ -236,7 +236,7 @@ func (api *API) appAuthFormRegister(c *gin.Context) {
}
session := sessions.Default(c)
if err := setSession(session, auth); err != nil {
errorPage(c, http.StatusUnauthorized, "Unauthorized.")
appErrorPage(c, http.StatusUnauthorized, "Unauthorized.")
return
}