[ https://issues.apache.org/jira/browse/TINKERPOP-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15074162#comment-15074162 ]
ASF GitHub Bot commented on TINKERPOP-1055: ------------------------------------------- GitHub user spmallette opened a pull request: https://github.com/apache/incubator-tinkerpop/pull/188 TINKERPOP-1055 Gremlin Console FileNotFoundException can be misleading https://issues.apache.org/jira/browse/TINKERPOP-1055 Some relatively minor refactoring required to get this working. Tested manually only as I wasn't sure how to write tests around the console when it was calling `System.exit(1)` on error. I first tested a "good" script: ```text $ cat test.groovy x=1 addItUp = {x,y -> x+y} $ bin/gremlin.sh test.groovy \,,,/ (o o) -----oOOo-(3)-oOOo----- plugin activated: tinkerpop.server plugin activated: tinkerpop.utilities plugin activated: tinkerpop.tinkergraph ==>1 ==>groovysh_evaluate$_run_closure1@5536379e gremlin> addItUp(1,10) ==>11 ``` Then I tested a script that wasn't present on the file system: ```text $ bin/gremlin.sh test1.groovy \,,,/ (o o) -----oOOo-(3)-oOOo----- plugin activated: tinkerpop.server plugin activated: tinkerpop.utilities plugin activated: tinkerpop.tinkergraph Gremlin initialization file not found at [test1.groovy]. ``` Finally, I tested a script with an error in the script itself: ```text $ cat test-fail.groovy x = 1 y = x / 0 $ bin/gremlin.sh test-fail.groovy \,,,/ (o o) -----oOOo-(3)-oOOo----- plugin activated: tinkerpop.server plugin activated: tinkerpop.utilities plugin activated: tinkerpop.tinkergraph ==>1 Bad line in Gremlin initialization file at [y = x / 0] - Division by zero ``` VOTE: +1 You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/incubator-tinkerpop TINKERPOP-1055 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-tinkerpop/pull/188.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 #188 ---- commit 1f6cb945c5ed0171a502c6468a648e8063fa1bef Author: Stephen Mallette <sp...@genoprime.com> Date: 2015-12-29T18:41:22Z Better error reporting around gremlin.sh init script. Refactored code a bit to catch exceptions related to IO on the init script itself versus errors in line of code evaluation. Not sure how to write tests here since we call System.exit(1) on error. commit 5463bd9cff76624067994e2469047d5ebbb305b6 Author: Stephen Mallette <sp...@genoprime.com> Date: 2015-12-29T18:44:11Z Update changelog. ---- > Gremlin Console FileNotFoundException can be misleading > ------------------------------------------------------- > > Key: TINKERPOP-1055 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1055 > Project: TinkerPop > Issue Type: Improvement > Components: console > Affects Versions: 3.1.0-incubating > Reporter: stephen mallette > Assignee: stephen mallette > Priority: Minor > Fix For: 3.1.1-incubating > > > Originally reported here in the old Gremlin project by mistake: > https://github.com/tinkerpop/gremlin/issues/393 > but basically, the Console currently catches all {{FileNotFoundException}} > errors (even those in the init script) and outputs the same error message > about the init file being missing. -- This message was sent by Atlassian JIRA (v6.3.4#6332)