You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/12/07 07:02:51 UTC

[GitHub] [maven-script-interpreter] olamy opened a new pull request, #87: catch this error to give more groovy error details

olamy opened a new pull request, #87:
URL: https://github.com/apache/maven-script-interpreter/pull/87

   Signed-off-by: Olivier Lamy <ol...@apache.org>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-script-interpreter] slawekjaranowski commented on a diff in pull request #87: catch this error to give more groovy error details

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on code in PR #87:
URL: https://github.com/apache/maven-script-interpreter/pull/87#discussion_r1041842648


##########
src/main/java/org/apache/maven/shared/scriptinterpreter/GroovyScriptInterpreter.java:
##########
@@ -78,6 +78,8 @@ public Object evaluateScript(
             }
         } catch (IOException e) {
             throw new ScriptEvaluationException(e);
+        } catch (Throwable e) {
+            throw new ScriptEvaluationException(e);

Review Comment:
   Does this wrap again exception from line: 75, 77 ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-script-interpreter] olamy merged pull request #87: catch this error to give more groovy error details

Posted by GitBox <gi...@apache.org>.
olamy merged PR #87:
URL: https://github.com/apache/maven-script-interpreter/pull/87


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-script-interpreter] olamy commented on a diff in pull request #87: catch this error to give more groovy error details

Posted by GitBox <gi...@apache.org>.
olamy commented on code in PR #87:
URL: https://github.com/apache/maven-script-interpreter/pull/87#discussion_r1042684765


##########
src/main/java/org/apache/maven/shared/scriptinterpreter/GroovyScriptInterpreter.java:
##########
@@ -67,16 +65,8 @@ public Object evaluateScript(
                     new Binding(globalVariables),
                     new CompilerConfiguration(CompilerConfiguration.DEFAULT));
 
-            try {
-                return interpreter.evaluate(script);
-            } catch (ThreadDeath e) {
-                throw e;
-            } catch (PowerAssertionError e) {
-                throw new ScriptEvaluationException("Assertion Error", e);

Review Comment:
   only 1 IT https://github.com/apache/maven-invoker-plugin/blob/d8a48716b2376a977ccdb0470f146dc5c1211258/src/it/script-streamLogs-false/verify.groovy#L45
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-script-interpreter] slawekjaranowski commented on a diff in pull request #87: catch this error to give more groovy error details

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on code in PR #87:
URL: https://github.com/apache/maven-script-interpreter/pull/87#discussion_r1042577814


##########
src/main/java/org/apache/maven/shared/scriptinterpreter/GroovyScriptInterpreter.java:
##########
@@ -67,16 +65,8 @@ public Object evaluateScript(
                     new Binding(globalVariables),
                     new CompilerConfiguration(CompilerConfiguration.DEFAULT));
 
-            try {
-                return interpreter.evaluate(script);
-            } catch (ThreadDeath e) {
-                throw e;
-            } catch (PowerAssertionError e) {
-                throw new ScriptEvaluationException("Assertion Error", e);

Review Comment:
   I added it in https://github.com/apache/maven-script-interpreter/pull/14/files
   Now I don't remember exactly why 😄 
   
   please check how assertions error will be reported by invoker
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-script-interpreter] olamy commented on a diff in pull request #87: catch this error to give more groovy error details

Posted by GitBox <gi...@apache.org>.
olamy commented on code in PR #87:
URL: https://github.com/apache/maven-script-interpreter/pull/87#discussion_r1041910867


##########
src/main/java/org/apache/maven/shared/scriptinterpreter/GroovyScriptInterpreter.java:
##########
@@ -78,6 +78,8 @@ public Object evaluateScript(
             }
         } catch (IOException e) {
             throw new ScriptEvaluationException(e);
+        } catch (Throwable e) {
+            throw new ScriptEvaluationException(e);

Review Comment:
   yes and no :) 
   the previous code was not catching this 
   ```
   Running pre-build script: /Volumes/workspace/dev/sources/maven/plugins/maven-invoker-plugin/target/it/selector-scripts/setup.groovy
   java.lang.ExceptionInInitializerError
   	at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:71)
   	at groovy.lang.GroovyObjectSupport.getDefaultMetaClass(GroovyObjectSupport.java:46)
   	at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:32)
   	at groovy.lang.Binding.<init>(Binding.java:36)
   	at org.apache.maven.shared.scriptinterpreter.GroovyScriptInterpreter.evaluateScript(GroovyScriptInterpreter.java:65)
   	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.executeRun(ScriptRunner.java:222)
   	at org.apache.maven.shared.scriptinterpreter.ScriptRunner.run(ScriptRunner.java:159)
   	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:2047)
   	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.runBuild(AbstractInvokerMojo.java:1721)
   	at org.apache.maven.plugins.invoker.AbstractInvokerMojo.lambda$runBuilds$4(AbstractInvokerMojo.java:1431)
   	at org.apache.maven.plugins.invoker.JobExecutor.lambda$null$1(JobExecutor.java:69)
   	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
   	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
   	at java.base/java.lang.Thread.run(Thread.java:829)
   Caused by: groovy.lang.GroovyRuntimeException: Conflicting module versions. Module [groovy-xml is loaded in version 4.0.6 and you are trying to load version 3.0.10
   	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl$DefaultModuleListener.onModule(MetaClassRegistryImpl.java:534)
   	at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromProperties(ExtensionModuleScanner.java:87)
   	at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanExtensionModuleFromMetaInf(ExtensionModuleScanner.java:81)
   	at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModulesFrom(ExtensionModuleScanner.java:63)
   	at org.codehaus.groovy.runtime.m12n.ExtensionModuleScanner.scanClasspathModules(ExtensionModuleScanner.java:54)
   	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:133)
   	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.<init>(MetaClassRegistryImpl.java:94)
   	at groovy.lang.GroovySystem.<clinit>(GroovySystem.java:37)
   ```
   but yeah it would be better to move L65 `new GroovyShell` inside the try



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-script-interpreter] slawekjaranowski commented on a diff in pull request #87: catch this error to give more groovy error details

Posted by GitBox <gi...@apache.org>.
slawekjaranowski commented on code in PR #87:
URL: https://github.com/apache/maven-script-interpreter/pull/87#discussion_r1042726073


##########
src/main/java/org/apache/maven/shared/scriptinterpreter/GroovyScriptInterpreter.java:
##########
@@ -67,16 +65,8 @@ public Object evaluateScript(
                     new Binding(globalVariables),
                     new CompilerConfiguration(CompilerConfiguration.DEFAULT));
 
-            try {
-                return interpreter.evaluate(script);
-            } catch (ThreadDeath e) {
-                throw e;
-            } catch (PowerAssertionError e) {
-                throw new ScriptEvaluationException("Assertion Error", e);

Review Comment:
   ok, code looks simpler



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [maven-script-interpreter] olamy commented on a diff in pull request #87: catch this error to give more groovy error details

Posted by GitBox <gi...@apache.org>.
olamy commented on code in PR #87:
URL: https://github.com/apache/maven-script-interpreter/pull/87#discussion_r1042040218


##########
src/main/java/org/apache/maven/shared/scriptinterpreter/GroovyScriptInterpreter.java:
##########
@@ -78,6 +78,8 @@ public Object evaluateScript(
             }
         } catch (IOException e) {
             throw new ScriptEvaluationException(e);
+        } catch (Throwable e) {
+            throw new ScriptEvaluationException(e);

Review Comment:
   I made exception management very more simple 🤣



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org