Errors as JSON does not work anymore?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Errors as JSON does not work anymore?

Dirk Dittmar
Hi,

I'm working with Grails 2.1.1 and I have a problem with the following
AJAX Action (if the command has errors):

import grails.converters.JSON

// ...

def saveOrUpdate = { FooBarCommand cmd ->
        if ( cmd.hasErrors() ) {
                response.setStatus 500
                render (cmd.errors as JSON)
        } else {
                // ...
        }
}

I always get the following exception:

"""
Cannot cast object 'grails.validation.ValidationErrors: 2 errors ...'
with class 'grails.validation.ValidationErrors' to class
'grails.converters.JSON'
"""

I'm pretty sure that this worked before but I can't tell you with witch
version of grails.

Is this a bug or intended behavior?



Regards,

Dirk

--
Dirk Dittmar <[hidden email]>
wortzwei gmbh
Entwicklung
Völckersstr. 14-20
D-22765 Hamburg
fon: +49 40 679 586 07
fax: +49 40 679 586 08
web: http://www.wortzwei.de/

Geschäftsführung:
Joris Wiebe, Markus Schwarz
Amtsgericht Hamburg HRB-91937

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Errors as JSON does not work anymore?

Vahid Pazirandeh
FYI - There is a bug filed for this: https://jira.grails.org/browse/GRAILS-11355