jstrachan | 29 Jan 07:41 2005
Picon

Re: [groovy-dev] line/column number in error output

Hi Petr

The first case is a compile error - the second is a runtime error. It 
appears the line numbers are not being correctly put into the bytecode 
so that the stack trace includes the line number information; this is 
strange as I thought this worked, but we might have broken something. We 
should raise an issue in JIRA for this

James

Petr Hamernik wrote:
> Hi,
> 
> I am trying to parse groovy output when running script with errors, 
> because I want to know which line number in the groovy source is wrong.
> 
> The problem is that not all exceptions contain line/column numbers and 
> so I can't always find out it from output. The first example prints line 
> number and the second one not:
> 
> 1) Source of test2.groovy:
> ==========================
> /* Test 2 */
> ***
> println 'hi'
> 
> -----
> And the execution looks like:
> 
> c:\groovytest> groovy test2.groovy
> 
> Caught: c:\groovytest\test2.groovy: 2: could not use '*' at 2:1; infix 
> operators may only follow expressions c:\groovytest\test2.groovy: 2: 
> could not use '*' at 2:1; infix operators may only follow expressions
> 
> 
> 2) Source of test3.groovy:
> ==========================
> 
> /* Test 3 */
> somethingUnknown
> println 'hi'
> 
> -----
> 
> c:\groovytest> groovy test3.groovy
> 
> Caught: groovy.lang.MissingPropertyException: No such property: 
> somethingUnknown for class: test3
>         at test3.run(c:\groovytest\test3.groovy)
>         at test3.main(c:\groovytest\test3.groovy)
> 
> 
> ===========================
> => For SyntaxExcepiton subclasses I see the line/column, but not for 
> groovy.lang.GroovyRuntimeException subclasses.
> 
> It is planned to implement the printing of line numbers for all 
> exceptions in the future? Or is there any reason why this is impossible?
> 
> thanks,
> petr
> 
> 


Gmane