mirror of
https://github.com/mainnika/nikita-tokarch-uk.git
synced 2026-05-25 01:03:35 +00:00
Add not-found error handler
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package renderer
|
||||
|
||||
import (
|
||||
"code.tokarch.uk/mainnika/nikita-tokarch-uk/frontend/content"
|
||||
routing "github.com/jackwhelpton/fasthttp-routing/v2"
|
||||
)
|
||||
|
||||
// errorNotFound renders http error-404 template
|
||||
func (r *Renderer) errorNotFound(c *routing.Context) (err error) {
|
||||
|
||||
errorContent := content.Error{Message: "not found"}
|
||||
|
||||
return c.Write(errorContent)
|
||||
}
|
||||
@@ -29,6 +29,7 @@ func (r *Renderer) init() {
|
||||
router := routing.New()
|
||||
|
||||
router.Use(r.useTemplateWriter)
|
||||
router.NotFound(r.errorNotFound)
|
||||
|
||||
r.router = router
|
||||
r.handler = router.HandleRequest
|
||||
|
||||
Reference in New Issue
Block a user