3.5. Interpreting Script Error Messages

When developing scripts ReportServer will support your debugging efforts by showing you full stack trace error messages. Lets go back to our simple userlist script but this time, I have included a typo:

package myscripts

import net.datenwerke.security.service.usermanager.entities.User;

GLOBALS.getEntitiesByType(User).collect{
	i.getUsername()
}.join("\n")

If we name this file "errorfile.groovy" and execute it, you will get the following error message:

Script execution failed.
error message: No such property: i for class: myscripts.Script22 (groovy.lang.MissingPropertyException)
script arguments:
file: errorfile.groovy (id: 6372, line 6)
line number: 6 (5)
line:    i.getUsername()

The error message provides the specific reason for the failure:

error message: No such property: i for class: myscripts.Script22 (groovy.lang.MissingPropertyException)

This tells us that the variable "i" is undefined. The error report also specifies the exact file and line number:

file: errorfile.groovy (id: 6372, line 6)
line number: 6 (5)
line:    i.getUsername()

By looking at line 6, we can see the origin of the failure:

    i.getUsername()

The code uses i, but in this context, it should have been the standard Groovy iterator it.