diff --git a/pages.go b/pages.go index 639e4bb..36a0e0d 100644 --- a/pages.go +++ b/pages.go @@ -449,7 +449,7 @@ type ErrorPage struct { HeadCommonPartial `tmpl:"head_common"` TopPartial `tmpl:"top"` FooterPartial `tmpl:"footer"` - Message string + Message template.HTML Errors string } @@ -457,15 +457,15 @@ func (e *ErrorPage) TemplateText() string { if e.Message != "" { return tmplError } - e.Message = "I cannot give any suggestions to solve the problem, maybe the best solution is to pubblicy blame the devs on Nostr" - if strings.Contains(e.Errors, "invalid checksum") { - e.Message = "It seems you entered an invalid event code, try to check if it is correct; a good idea is compare the first and the last characters" - } else if strings.Contains(e.Errors, "couldn't find this") { - e.Message = "I can't find the event, maybe it is new and has not been already propagated on the relays I'm checking; you can try again in some time" - } else if strings.Contains(e.Errors, "invalid bech32 string length") { - e.Message = "I can't find what you are serching for, and this doesn't seem an event at all, sorry" - } else if strings.Contains(e.Errors, "invalid separator") { - e.Message = "This is so wrong I can't even begin to help you, you are probably trolling me" + switch { + case strings.Contains(e.Errors, "invalid checksum"): + e.Message = "It looks like you entered an invalid event code.
Check if you copied it fully, a good idea is compare the first and the last characters." + case strings.Contains(e.Errors, "couldn't find this"): + e.Message = "Can't find the event in the relays. Try getting an `nevent1` code with relay hints." + case strings.Contains(e.Errors, "invalid bech32 string length"), strings.Contains(e.Errors, "invalid separator"): + e.Message = "You have typed a wrong event code, we need a URL path that starts with /npub1, /nprofile1, /nevent1, /naddr1, or something like /name@domain.com (or maybe just /domain.com) or an event id as hex (like /aef8b32af...)" + default: + e.Message = "I can't give any suggestions to solve the problem.
Please tag daniele and fiatjaf and complain!" } return tmplError }