use of org.neo4j.server.rest.domain.EvaluationException in project neo4j by neo4j.
the class RestfulGraphDatabase method createPagedTraverser.
@POST
@Path(PATH_TO_CREATE_PAGED_TRAVERSERS)
public Response createPagedTraverser(@PathParam("nodeId") long startNode, @PathParam("returnType") TraverserReturnType returnType, @QueryParam("pageSize") @DefaultValue(FIFTY_ENTRIES) int pageSize, @QueryParam("leaseTime") @DefaultValue(SIXTY_SECONDS) int leaseTimeInSeconds, String body) {
try {
validatePageSize(pageSize);
validateLeaseTime(leaseTimeInSeconds);
String traverserId = actions.createPagedTraverser(startNode, input.readMap(body), pageSize, leaseTimeInSeconds);
URI uri = new URI("node/" + startNode + "/paged/traverse/" + returnType + "/" + traverserId);
return output.created(new ListEntityRepresentation(actions.pagedTraverse(traverserId, returnType), uri.normalize()));
} catch (EvaluationException e) {
return output.badRequest(e);
} catch (BadInputException e) {
return output.badRequest(e);
} catch (NotFoundException e) {
return output.notFound(e);
} catch (URISyntaxException e) {
return output.serverError(e);
}
}
use of org.neo4j.server.rest.domain.EvaluationException in project neo4j by neo4j.
the class JavascriptExecutor method execute.
@Override
public Object execute(Map<String, Object> variables) throws EvaluationException {
Context cx = Context.enter();
try {
Scriptable scope = cx.newObject(prototype);
scope.setPrototype(prototype);
if (variables != null) {
for (String k : variables.keySet()) {
scope.put(k, scope, variables.get(k));
}
}
Object out = compiledScript.exec(cx, scope);
if (out instanceof NativeJavaObject) {
return ((NativeJavaObject) out).unwrap();
} else if (out instanceof Undefined) {
return null;
} else {
return out;
}
} catch (RhinoException e) {
throw new EvaluationException("Failed to execute script, see nested exception.", e);
} finally {
Context.exit();
}
}
Aggregations