Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception thrown during respond() is not handled with url mapping for 500 #9473

Closed
kuceram opened this issue Dec 9, 2015 · 2 comments
Closed
Assignees
Milestone

Comments

@kuceram
Copy link

kuceram commented Dec 9, 2015

Having a converter for Domain class which might throw an exception, i.e.:

class MyDomainMarshaller {

    @javax.annotation.PostConstruct
    void registerMarshallers() {
        JSON.registerObjectMarshaller(MyDomain) { myDomain ->
            throw new RuntimeException("some exception")
        }
    }
}

brings problem when rendering response with controller respond method:

def show(Long id) {
    respond MyDomain.get(id)
}

This exception should result in rendering 500 defined in url mappings:

"500"(controller: "error", action: "index")

It renders 200 with following content [. It seems that response was partially rendered.

@AlexKovynev
Copy link

With interceptors seem to have the same problem. At least 404 are not mapped.

@graemerocher graemerocher added this to the grails-3.0.12 milestone Jan 13, 2016
@graemerocher
Copy link
Member

Yeah the issue here is the response has already been committed by the time the exception happens so at that point there is no going back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants