clean up the mvc error handler example

Former-commit-id: 30e42fe0a6c39909739ec6423d75a2be0fe4f1f6
This commit is contained in:
Gerasimos (Makis) Maropoulos 2019-04-16 18:08:03 +03:00
parent 0d4d2bd3fa
commit 7df7f0fea2

View File

@ -26,18 +26,13 @@ func main() {
app.Run(iris.Addr(":8080"))
}
func basicMVC(app *mvc.Application) {
// GET: http://localhost:8080
app.Handle(new(myController))
}
type myController struct {
}
// overriddes the mvcApp.HandleError function.
// func (c *myController) HandleError(ctx iris.Context, err error) {
// ctx.HTML(fmt.Sprintf("<i>%s</i>", err.Error()))
// }
func (c *myController) HandleError(ctx iris.Context, err error) {
ctx.HTML(fmt.Sprintf("<i>%s</i>", err.Error()))
}
func (c *myController) Get() error {
return fmt.Errorf("error here")