Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does Grails strip my exceptions?

If you put this in a controller action:

def inner = new RuntimeException("inner")
def middle = new Exception("middle", inner)
def outer = new IllegalArgumentException("outer", middle)
throw outer

Grails' error debug page (and most importantly, the logs) will only show the inner exception class and its message:

Error 500: Internal Server Error

URI: /...
Class: java.lang.RuntimeException
Message: inner

This is problematic, because when you choose to wrap an exception with a more descriptive message, most of the times it's the outer message that's more important in debugging the issue.

Actually, it would be useful to have all exception in the cause chain, with their class name, message and stack trace, just like regular Java does.

I've tried printing the exception myself in the error page, but the stripping happens before the error view is called.

Is there a configuration parameter somewhere that can change this behaviour?

Edit: I've posted a bug and started a mailing list thread, but so far I haven't found a workaround, nor even the place in the Grails source code where this stripping happens.

like image 783
Tobia Avatar asked Dec 19 '14 18:12

Tobia


1 Answers

Try this:

You can completely disable stacktrace filtering by setting the grails.full.stacktrace VM property to "true" i.e. add the -Dgrails.full.stacktrace=true option to your application startup script.

like image 68
Dónal Avatar answered Oct 07 '22 02:10

Dónal