有没有办法在 Grails 站点上发生 Grails 错误时向自己发送详细信息?
设置它的最佳方法是什么?在一个地方? (试图保持干燥)
我想包括产生错误的 URL。
最佳答案
.
如果您打算捕获项目中发生的任何异常并将其邮寄,那么我正在使用这样的设置,并且我通过以下方式进行了操作:
.
def reportError = {attrs, body ->
String error = body()
//error will have the Error Details, you can mail this string :)
//mail example
mailService.mailError(error) //just an example
//if you want to show the error on the error page
out << error
//if you want to show any custom message
out << "Error mailed, check Email"
}
全部做完... :)
现在发生的事情是,每当发生异常(即使在 AJAX 调用中)请求被重定向到错误页面时,我们都可以捕获所有错误。
此设置不起作用的唯一地方是未绑定(bind)在请求上的执行,即:JOBS。
在这种方法中,我能够捕获所有未预料到的异常:)
..
我就是这样做的,希望有帮助:)
问候库沙尔
关于grails - 来自 Grails 的关于 Grails 错误的电子邮件通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8436047/