Is there a way to send myself the details anytime a Grails Error happens on a Grails site? What is the best way to set this up? In one place? (trying to stay DRY)
And I would like to include the URL that produced the error.
. If you intend to catch any Exception happening on your project and mail it, well i am using such setup, and i did it in the following way: .
Created a Tag in the TagLib:
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"
}
ALL DONE... :)
Now what is happening is, whenever an exception occours(Even in AJAX Calls) the request is redirected to the error page, there we can capture all errors.
The Only place where this setup will not work is in the case of executions which are not binded on the request, that is: JOBS.
In this method i was able to catch all unanticipated Exceptions :) ..
thats how i do, hope that Helps :)
Regards Kushal
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With