What?
Add a configuration param that can be used to skip notice-sending for certain types of exceptions. For example, imagine I don't want to send a notice for all exceptions of type IllegalArgumentException or IllegalStateException
This could be configured using a list of exception class names:
grails.plugins.airbrake.excludes = ['java.lang.IllegalArgumentException', 'java.lang.IllegalStateException']
or alternatively, one or more exception class name patterns:
grails.plugins.airbrake.excludes = ['java.lang.Illegal.*Exception']
I considered a list of exception classes instead of a list of exception class names, but decided against the former approach because it would require the exception to be on the classpath at compile-time.
Why?
In my application I have a global error handler configured in UrlMappings.groovy
"500"(controller: "errors", action: "serverError")
which does the following (among other things)
class ErrorsController {
def serverError = {
log.error 'unhandled exception', request.exception
}
}
However, this causes the exception to be logged twice in Errbit
- Once with the exceptions actual type and place of origin
- Once with an exception type of GrailsWrappedRuntimeException. The origin of this second occurrence is the
log.error
statement in the global error handler
So in my case I want to use this config param to exclude these duplicates:
grails.plugins.airbrake.excludes = ['org.codehaus.groovy.grails.web.errors.GrailsWrappedRuntimeException']
I can imagine there might be other cases where this feature might be useful, e.g. a 3rd party library is throwing an exception that you don't care about (and can't change the code to prevent it).