Grails
  1. Grails
  2. GRAILS-7882

Console exception messages lack vital info

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-M1
    • Fix Version/s: 2.0-M2
    • Component/s: Controllers
    • Labels:
      None

      Description

      If an exception is thrown from within my request handling I get a poor message at the console. For instance consider the following controller action:

      def testErrorReporting = {
      throw new Exception("Test exception")
      }

      When invoked that gives the following in the console (I'm using grails interactive mode), which doesn't include the original exception type or message, nor a line number for where it was thrown. The error shown in the browser does include those things.

      Error 2011-08-11 17:42:13,917 ["http-bio-8080"-exec-5] ERROR errors.GrailsExceptionResolver - Exception occurred when processing request: [GET] /LunchApp20T2/week/testErrorReporting
      Stacktrace follows:
      Line | Method
      ->> 37 | doCall in com.softwire.lunchapp.WeekController$_closure3$$EN7Hlm1g

      • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        886 runTask in java.util.concurrent.ThreadPoolExecutor$Worker
        908 run . . in ''
        ^ 680
        run in java.lang.Thread

        Activity

        Hide
        Graeme Rocher added a comment -

        Can you attach an example? From a controller with an action like:

        class FooController {
        
            def index() { 
                throw new Exception("Bad")
            }
        }
        

        I get:

        
        Stacktrace follows:
           Line | Method
        ->>   6 | index   in sec.demo.FooController$$EN7qBjRA
        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
        |   886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
        |   908 | run . . in     ''
        ^   680 | run     in java.lang.Thread
        
        Show
        Graeme Rocher added a comment - Can you attach an example? From a controller with an action like: class FooController { def index() { throw new Exception( "Bad" ) } } I get: Stacktrace follows: Line | Method ->> 6 | index in sec.demo.FooController$$EN7qBjRA - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker | 908 | run . . in '' ^ 680 | run in java.lang. Thread
        Hide
        Sam Carr added a comment -

        Graeme - your example already demonstrates my point exactly

        The console message does not contain the exception class, exception message or the line number in the controller of where it was thrown. I would expect all of these to be present (it's very hard to debug the issue without them) and indeed I'm sure they used to be pre 2.0.

        Show
        Sam Carr added a comment - Graeme - your example already demonstrates my point exactly The console message does not contain the exception class, exception message or the line number in the controller of where it was thrown. I would expect all of these to be present (it's very hard to debug the issue without them) and indeed I'm sure they used to be pre 2.0.
        Hide
        Sam Carr added a comment -

        I've just realised I'm being an idiot about the line numbers - they're hiding in plain sight on the left there! It's interesting how I just haven't noticed them there, and I've been using 2.0 for weeks. I think it's because the line numbers used to be after the filename and still are in the message shown in my browser (though that might be because it's an upgraded project with the old-style error page).

        I stand by my comment regarding exception class and message though

        Show
        Sam Carr added a comment - I've just realised I'm being an idiot about the line numbers - they're hiding in plain sight on the left there! It's interesting how I just haven't noticed them there, and I've been using 2.0 for weeks. I think it's because the line numbers used to be after the filename and still are in the message shown in my browser (though that might be because it's an upgraded project with the old-style error page). I stand by my comment regarding exception class and message though
        Hide
        Graeme Rocher added a comment -

        The exception class can be seen here:

        ->>   6 | index   in sec.demo.FooController$$EN7qBjRA
        
        Show
        Graeme Rocher added a comment - The exception class can be seen here: ->> 6 | index in sec.demo.FooController$$EN7qBjRA
        Hide
        Sam Carr added a comment -

        I mean the class of the exception that was thrown - in my example above that is "Exception" but might be "NullPointerException" or whatever was thrown. Neither that nor the message from the exception ("Bad" in my example) are in the console output and I consider them vital to debugging the error.

        Show
        Sam Carr added a comment - I mean the class of the exception that was thrown - in my example above that is "Exception" but might be "NullPointerException" or whatever was thrown. Neither that nor the message from the exception ("Bad" in my example) are in the console output and I consider them vital to debugging the error.

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Sam Carr
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development