not found page

This commit is contained in:
2026-01-19 12:01:15 -07:00
parent 4dd2f9aa89
commit afeb28f7f3
5 changed files with 110 additions and 15 deletions
+19
View File
@@ -14,6 +14,7 @@ type (
err error
msg string
status int
html []byte
}
)
@@ -77,6 +78,11 @@ func (e ErrorResponse) Wrap(err error) ErrorResponse {
return e
}
func (e ErrorResponse) HTML(h []byte) ErrorResponse {
e.html = h
return e
}
// error implementation
func (e ErrorResponse) Error() string {
@@ -130,6 +136,19 @@ func (e ErrorResponse) GetMsg() (string, bool) {
return "", false
}
func (e ErrorResponse) GetHTML() ([]byte, bool) {
if len(e.html) != 0 {
return e.html, true
}
ce, ok := GetError(e.err)
if ok {
return ce.GetHTML()
}
return nil, false
}
func GetError(err error) (e ErrorResponse, ok bool) {
ok = errors.As(err, &e)
return e, ok