## 6.4.4 Mapping to Response Codes

Grails also allows you to map HTTP response codes to controllers, actions or views. All you have to do is use a method name that matches the response code you are interested in:

    static mappings = {
       "500"(controller:"errors", action:"serverError")
       "404"(controller:"errors", action:"notFound")
       "403"(controller:"errors", action:"forbidden")
    }

Or alternatively if you merely want to provide custom error pages:

    static mappings = {
       "500"(view:"/errors/serverError")
       "404"(view:"/errors/notFound")
       "403"(view:"/errors/forbidden")
    }