Skip to content

Instantly share code, notes, and snippets.

@mlescaille
Created August 5, 2020 01:26
Show Gist options
  • Save mlescaille/4fb8118257afbdfc5d8c8c73b13a436e to your computer and use it in GitHub Desktop.
Save mlescaille/4fb8118257afbdfc5d8c8c73b13a436e to your computer and use it in GitHub Desktop.
import grails.artefact.Enhances
import org.grails.core.artefact.ControllerArtefactHandler
@Enhances(ControllerArtefactHandler.TYPE) //you can do the same with ServiceArtefactHandler.TYPE
trait ExceptionHandler {
def handleControllerError(Exception e) {
response.status = 400
render ApiError.unknownError as JSON
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment