[
https://issues.apache.org/jira/browse/METRON-1493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16401864#comment-16401864
]
ASF GitHub Bot commented on METRON-1493:
----------------------------------------
GitHub user nickwallen opened a pull request:
https://github.com/apache/metron/pull/966
METRON-1493 Unhelpful Error Message When Assignment Expressions Fail
When executing an assignment expression that fails, the error message is
less than helpful. Prior to this PR the error message looks something like
this.
```
[Stellar]>>> p := 0/0
[!] Assignment expression failed
java.lang.IllegalArgumentException: Assignment expression failed
at
org.apache.metron.stellar.common.shell.StellarResult.error(StellarResult.java:115)
at
org.apache.metron.stellar.common.shell.specials.AssignmentCommand.execute(AssignmentCommand.java:82)
at
org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.execute(DefaultStellarShellExecutor.java:252)
at
org.apache.metron.stellar.common.shell.cli.StellarShell.execute(StellarShell.java:357)
at org.jboss.aesh.console.AeshProcess.run(AeshProcess.java:53)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
```
This has now been fixed so that you can understand exactly what happened.
```
[Stellar]>>> x := 0/0
[!] / by zero
java.lang.ArithmeticException: / by zero
at
org.apache.metron.stellar.common.evaluators.ArithmeticEvaluator$ArithmeticEvaluatorFunctions.lambda$division$3(ArithmeticEvaluator.java:98)
at
org.apache.metron.stellar.common.evaluators.ArithmeticEvaluator.evaluate(ArithmeticEvaluator.java:39)
at
org.apache.metron.stellar.common.StellarCompiler.lambda$exitArithExpr_div$2(StellarCompiler.java:316)
at
org.apache.metron.stellar.common.StellarCompiler$Expression.apply(StellarCompiler.java:190)
at
org.apache.metron.stellar.common.BaseStellarProcessor.parse(BaseStellarProcessor.java:145)
at
org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.executeStellar(DefaultStellarShellExecutor.java:401)
at
org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.execute(DefaultStellarShellExecutor.java:257)
at
org.apache.metron.stellar.common.shell.specials.AssignmentCommand.execute(AssignmentCommand.java:66)
at
org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.execute(DefaultStellarShellExecutor.java:252)
at
org.apache.metron.stellar.common.shell.cli.StellarShell.execute(StellarShell.java:357)
at org.jboss.aesh.console.AeshProcess.run(AeshProcess.java:53)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
```
To test this, launch the REPL and try it out.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/nickwallen/metron METRON-1493
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/metron/pull/966.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #966
----
commit 88ffa5be69e0901ac6c79952ffe164d2de4ef2a7
Author: Nick Allen <nick@...>
Date: 2018-03-16T13:15:59Z
METRON-1493 Unhelpful Error Message When Assignment Expressions Fail
----
> Unhelpful Error Message When Assignment Expressions Fail
> --------------------------------------------------------
>
> Key: METRON-1493
> URL: https://issues.apache.org/jira/browse/METRON-1493
> Project: Metron
> Issue Type: Improvement
> Affects Versions: 0.4.2
> Reporter: Nick Allen
> Assignee: Nick Allen
> Priority: Major
> Fix For: Next + 1
>
>
> When running a bad assignment expression in the REPL, the error message
> provides no help as to why the expression fails. It only says that the
> expression fails, which is obvious. This needs to report back to the user
> the root cause of the assignment expression failing.
> {code}
> [Stellar]>>> p := 0/0
> [!] Assignment expression failed
> java.lang.IllegalArgumentException: Assignment expression failed
> at
> org.apache.metron.stellar.common.shell.StellarResult.error(StellarResult.java:115)
> at
> org.apache.metron.stellar.common.shell.specials.AssignmentCommand.execute(AssignmentCommand.java:82)
> at
> org.apache.metron.stellar.common.shell.DefaultStellarShellExecutor.execute(DefaultStellarShellExecutor.java:252)
> at
> org.apache.metron.stellar.common.shell.cli.StellarShell.execute(StellarShell.java:357)
> at org.jboss.aesh.console.AeshProcess.run(AeshProcess.java:53)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> at java.lang.Thread.run(Thread.java:748)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)