import grails.util.GrailsUtil
import grails.converters.XML

class FooController {

    FooService fooService

    def execute = {
        try {
            fooService.execute()
        } catch(e) {
            GrailsUtil.deepSanitize(e).printStackTrace()
        }

        render Foo.getAll() as XML
    }

    def checked = {
        try {
            fooService.checked()
        } catch(e) {
            GrailsUtil.deepSanitize(e).printStackTrace()
        }

        render Foo.getAll() as XML
    }

    def unchecked = {
        try {
            fooService.unchecked()
        } catch(e) {
            GrailsUtil.deepSanitize(e).printStackTrace()
        }

        render Foo.getAll() as XML
    }

    def validation = {
        try {
            fooService.validation()
        } catch(e) {
            GrailsUtil.deepSanitize(e).printStackTrace()
        }

        render Foo.getAll() as XML
    }

}

import grails.util.GrailsUtil
import grails.converters.XML

class FooController {

    FooService fooService

    def execute = {
        invokeTransactionalMethod { fooService.execute() }
    }

    def checked = {
        invokeTransactionalMethod { fooService.checked() }
    }

    def unchecked = {
        invokeTransactionalMethod { fooService.unchecked() }
    }

    def validation = {
        invokeTransactionalMethod { fooService.validation() }
    }

    private void invokeTransactionalMethod(Closure work) {
        try {
            work()
        } catch (e) {
            GrailsUtil.deepSanitize(e).printStackTrace()
        }

        render Foo.getAll() as XML
    }

}

Reduce copy/paste code in a test controller.
Reduce copy/paste code in a test controller.
