fix: display error page instead of panic on non existant note
This commit is contained in:
parent
e03aa6b87a
commit
28cdb3ee8f
1 changed files with 6 additions and 0 deletions
|
@ -341,6 +341,12 @@ func (h *GetWebNoteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if note == nil {
|
||||
h.PageData.Err = fmt.Errorf("Note doesn't exist or has been deleted")
|
||||
h.Templates.ExecuteTemplate(w, templateName, h.PageData)
|
||||
return
|
||||
}
|
||||
|
||||
if note.Encrypted {
|
||||
h.PageData.Err = fmt.Errorf("note is encrypted")
|
||||
h.Templates.ExecuteTemplate(w, templateName, h.PageData)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue