Tuesday, April 5, 2011

how to display grails error from bootstrap

Hi,

I just found annoying bug from my bootstrap.groovy. If I did a mistake for example, like undeclared variable, the apps keep running and then when I tried to access the apps from web it will display

HTTP Status 404 -

type Status report

message

description The requested resource () is not available. Apache Tomcat/6.0-snapshot

in the console there is no error messages appear ... so it makes confuse. suppose I edit 10 bootstrap and in one of them I did make a mistakes, it would become so difficult to find that little bug.

any idea how to solve this problem ? is it a tips to display those errors ?

From stackoverflow
  • I don't know what you're doing in your bootstrap, but if its failing when you're saving domain objects, then you can log those as errors the same way you would in a controller. If you want the errors to go to a console, just set up a console appender:

    //Remember, save calls validate()
    if(!myObject.save()) {
        myObject.errors.allErrors.each {
            log.error it
        }
    }
    

    References:

0 comments:

Post a Comment