开发者

Getting details of the error inside a custom error page

I implemented a controller that handles HTTP error codes:

class ErrorController {

    // 500
    def internalserver = {

    }

    // 504
    def timeout = {

    }

    // 404
    def notfound = {
        // just testing the values
        log.debug "params: ${params}"
        log.debug "response: ${response}"
        log.debug "url: ${response.redirectURL}"
        log.debug "object: ${response.content}"
    }

    // 403
    def forbidden = {

    }
}

Note that i already updated the UrlMappings too.

"500"(controller:'error', action:'internalserver')
"504"(controller:'erro开发者_如何学Pythonr', action:'timeout')
"404"(controller:'error', action:'notfound')
"403"(controller:'error', action:'forbidden')

Is there a way to retrieve details inside each action?

i.e. for 404, the URL that was requested. for 500, the exception message or something.


looks like by simply referring to:

grails-app/views/error.gsp

will reveal all needed information.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜