Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3369

Better error message for Grab parameter errors

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.6
    • 1.6.1, 1.7-beta-1
    • None
    • None

    Description

      Running this:

      import org.xbill.DNS.*
      
      @Grab(group = 'dnsjava', artifact = 'dnsjava', version = '2.0.1')
      def domain(name) {
          def records = new Lookup(name, Type.MX).run()
          records.each { mx ->
              println "Host $mx.target has preference $mx.priority"
          }
      }
      
      domain("gr8conf.org")
      

      Note the mistake: I used artifact instead of module.

      And I got the stacktrace below.
      A nicer error message would be more friendly

      BUG! exception in phase 'conversion' in source unit 'ConsoleScript9' null
      at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:805)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:466)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:281)
      at groovy.lang.GroovyShell.parseClass(GroovyShell.java:590)
      at groovy.lang.GroovyShell.run(GroovyShell.java:470)
      at groovy.lang.GroovyShell.run(GroovyShell.java:451)
      at groovy.lang.GroovyShell.run(GroovyShell.java:160)
      at groovy.lang.GroovyShell$run$0.call(Unknown Source)
      at groovy.ui.Console$_runScriptImpl_closure13.doCall(Console.groovy:732)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:150)
      at groovy.ui.Console$_runScriptImpl_closure13.doCall(Console.groovy)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:86)
      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:234)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:892)
      at groovy.lang.Closure.call(Closure.java:279)
      at groovy.lang.Closure.call(Closure.java:274)
      at groovy.lang.Closure.run(Closure.java:355)
      at java.lang.Thread.run(Thread.java:613)

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            shemnon Daniel Ferrin
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment