Forward an exception to a controller

If you have to improve the way error are handle by grails.

class UrlMappings {
  static mappings {
    "403" (controller: "error", action: "forbidden")
    "404" (controller: "error", action: "notFound")
    "500" (controller: "error", action: "internalError")
  }
}

So any page status with 500 will be handled by the internalError action in the error controller. Individual exceptions can be also configured in the response code to give more fine grained level control

"500" (controller: "error", action: "nullPointer", exception: NullPointerException)
"500" (controller: "error", action: "illegalArgument", exception: IllegalArgumentException)

This allows any NullPointerException with 500 http status code to be handled by nullPointer action of error controller.

source: http://groovy.dzone.com/articles/grails-exception-handling-http