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
+7 -7
View File
@@ -50,7 +50,7 @@ func EditProfileForm(ctxt ui.AmContext) (string, any) {
}
u := ctxt.CurrentUser()
if u.IsAnon {
return "error", "you are not logged in"
return "error", ELOGIN
}
dlg, err := ui.AmLoadDialog("profile")
if err == nil {
@@ -108,7 +108,7 @@ func EditProfileForm(ctxt ui.AmContext) (string, any) {
func EditProfile(ctxt ui.AmContext) (string, any) {
u := ctxt.CurrentUser()
if u.IsAnon {
return "error", "you are not logged in"
return "error", ELOGIN
}
dlg, err := ui.AmLoadDialog("profile")
if err == nil {
@@ -219,7 +219,7 @@ func ProfilePhotoForm(ctxt ui.AmContext) (string, any) {
}
u := ctxt.CurrentUser()
if u.IsAnon {
return "error", "you are not logged in"
return "error", ELOGIN
}
ci, err := u.ContactInfo(ctxt.Ctx())
if err == nil {
@@ -242,7 +242,7 @@ func ProfilePhotoForm(ctxt ui.AmContext) (string, any) {
func ProfilePhoto(ctxt ui.AmContext) (string, any) {
u := ctxt.CurrentUser()
if u.IsAnon {
return "error", "you are not logged in"
return "error", ELOGIN
}
ci, err := u.ContactInfo(ctxt.Ctx())
if err != nil {
@@ -313,7 +313,7 @@ func ProfilePhoto(ctxt ui.AmContext) (string, any) {
happy = true
return "redirect", "/profile?tgt=" + url.QueryEscape(target)
}
return "error", "invalid button detected in photo upload"
return "error", EBUTTON
}
/* ShowProfile displays a user's profile.
@@ -441,7 +441,7 @@ func ShowProfile(ctxt ui.AmContext) (string, any) {
func QuickEMail(ctxt ui.AmContext) (string, any) {
me := ctxt.CurrentUser()
if me.IsAnon {
return "error", "you are not logged in"
return "error", ELOGIN
}
myCI, err := me.ContactInfo(ctxt.Ctx())
if err != nil {
@@ -481,7 +481,7 @@ func QuickEMail(ctxt ui.AmContext) (string, any) {
func Hotlist(ctxt ui.AmContext) (string, any) {
me := ctxt.CurrentUser()
if me.IsAnon {
return "error", "you are not logged in"
return "error", ELOGIN
}
hotlist, err := database.AmGetConferenceHotlist(ctxt.Ctx(), me)
if err != nil {