Skip to content

TINKERPOP-1055 Gremlin Console FileNotFoundException can be misleading#188

Merged
asfgit merged 2 commits intomasterfrom
TINKERPOP-1055
Dec 30, 2015
Merged

TINKERPOP-1055 Gremlin Console FileNotFoundException can be misleading#188
asfgit merged 2 commits intomasterfrom
TINKERPOP-1055

Conversation

@spmallette
Copy link
Contributor

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:

$ 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:

$ 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:


$ 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

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.
@twilmes
Copy link
Contributor

twilmes commented Dec 29, 2015

Looking good.

VOTE: +1

@okram
Copy link
Contributor

okram commented Dec 29, 2015

VOTE +1

@asfgit asfgit merged commit 5463bd9 into master Dec 30, 2015
@asfgit asfgit deleted the TINKERPOP-1055 branch February 8, 2016 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants