grails - 使用Grails错误error.gsp和GrailsWrappedRuntimeException错误

标签 grails

接受异常并将其转换为GrailsWrappedRuntimeException之后,renderException标记将引发错误。

Controller 代码:

def onError(Exception e) {
        def ge = new GrailsWrappedRuntimeException( servletContext, e )
        assert ge instanceof GrailsWrappedRuntimeException
        render(view: "/error", model: [ exception: ge ])
    }

error.gsp
<g:renderException exception="${exception}" />

异常(exception):
No signature of method: org.codehaus.groovy.grails.plugins.web.taglib.RenderTagLib.prettyPrintStatus() is applicable for argument types: (null) values: [null]. Stacktrace follows:
Message: Error processing GroovyPageView: Error executing tag <g:renderException>: No signature of method: org.codehaus.groovy.grails.plugins.web.taglib.RenderTagLib.prettyPrintStatus() is applicable for argument types: (null) values: [null]

最佳答案

看起来属性名称“exception”是Grails错误处理机制所特有的。在我看来,该属性名称已被grails的默认错误处理机制所覆盖。如果我在 Controller 和error.gsp中将名称更改为其他名称,例如“foo_exception”,则页面会正确显示传递给onError的异常。

关于grails - 使用Grails错误error.gsp和GrailsWrappedRuntimeException错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24678526/

相关文章:

grails - 重写 Controller 中默认操作的 URL

javascript - 如何从数据库动态更新号码

grails - Webflow的操作状态能否在成功后具有多个重定向?

Grails 未在 IntelliJ 上执行 (NoClassDefFoundError)

Grails 将对象传递给 View 并再次返回

java - Grails 中的使用和 OAuth2 安全 API (Twitter)

javascript - 带有闪烁器的Grails Flash消息

grails - 在另一个 session 中使用 session 变量grails 2.4.2

grails - 将 grails 与 hashcorp vault 集成

grails - 如何从g:render Errors Grails中删除自动标记(<ul>和<li>)?