When saving domain objects using Grails / GORM, I often wonder why the save () call fails.
This is easy to solve by adding logic:
if (!o.save()) {
o.errors.allErrors.each { println it }
}
However, adding this everywhere, I do .save (), adds a lot of duplicate code. In the spirit of DRY, I would like to configure Grails / GORM to automatically print any save errors to the console (stderr). Is it possible? If not, how do I extend GORM to make this possible?
knorv source
share