factored out some common error messages to error objects that can be referenced

This commit is contained in:
2026-02-10 18:04:36 -07:00
parent cf5d4422ac
commit 38c4b3f71e
8 changed files with 42 additions and 24 deletions
+10
View File
@@ -10,6 +10,7 @@
package main
import (
"errors"
"net/http"
"git.erbosoft.com/amy/amsterdam/ui"
@@ -17,12 +18,21 @@ import (
log "github.com/sirupsen/logrus"
)
// EBUTTON is the standard error for an unknown button.
var EBUTTON error = errors.New("invalid or unknown button pressed")
// ELOGIN is the standard error for not being logged in
var ELOGIN error = errors.New("you are not logged in")
// ENOPERM is the standard "not permitted" error message.
var ENOPERM *echo.HTTPError = echo.NewHTTPError(http.StatusForbidden, "you are not permitted to perform this operation")
// ENOACCESS is the standard "no access" error message.
var ENOACCESS *echo.HTTPError = echo.NewHTTPError(http.StatusForbidden, "you are not permitted to access this page")
// EPARAM is an error for no parameters being specified.
var EPARAM error = errors.New("no parameters specified")
/* NotImplPage is used for all TODO links, to show that something hasn't yet been implemented.
* Parameters:
* ctxt - The AmContext for the request.