thingdom / node-neo4j

[RETIRED] Neo4j graph database driver (REST API client) for Node.js
Apache License 2.0
926 stars 138 forks source link

Error when performing a query #128

Closed nomadster closed 10 years ago

nomadster commented 10 years ago

I'm doing this

this.get = function*(username){
        if(!username){
            throw new Error('Missing parameter');
        }
        var query = [
            'MATCH (u:User {username: {usr}})-[:has_bookmark]->(b:Bookmark)',
            'RETURN b.blob'
        ];

        var params = {
            usr: username
        };

        return yield GraphDBService.query(query,params);
    };

with GraphDBService.query() being kind of a wrapper that call yours query() like this

this.query = function(query, params, transformResultFunction){

        transformResultFunction = transformResultFunction || identityFunction;

        return function(callback){
            db.query(query, params, function(err, res){
                if(err){
                    callback(err);
                } else {
                    res = transformResultFunction(res);
                    callback(undefined,res);
                }
            });
        };
    };

transformResultFunction being an optional argument that does what it says :)

When executing the query i get the following error

Error
    at exports.adjustError (/our_framework/node_modules/neo4j/lib/util.js:71:15)
    at __$GraphDatabase_prototype_query__20 (/our_framework/node_modules/neo4j/lib/GraphDatabase.js:899:26)
    at /our_framework/node_modules/neo4j/node_modules/streamline/lib/callbacks/runtime.js:159:5
    at Object.__g.trampoline.flush (/our_framework/node_modules/neo4j/node_modules/streamline/lib/callbacks/runtime.js:22:29)
    at Request.___ [as _callback] (/our_framework/node_modules/neo4j/node_modules/streamline/lib/callbacks/runtime.js:113:61)
    at Request.self.callback (/our_framework/node_modules/neo4j/node_modules/request/request.js:129:22)
    at Request.EventEmitter.emit (events.js:107:17)
    at Request.<anonymous> (/our_framework/node_modules/neo4j/node_modules/request/request.js:873:14)
    at Request.EventEmitter.emit (events.js:126:20)
    at IncomingMessage.<anonymous> (/our_framework/node_modules/neo4j/node_modules/request/request.js:824:12)

I'm wondering if I'm doing something wrong or I've just spotted a bug. Let me know if I have to send additional informations. :)

nomadster commented 10 years ago

I forgot a .join('\n'); Sorry. :(

aseemk commented 10 years ago

Glad you figured it out!

I'm surprised the error message is empty in this case though. I'll try to take a look at it later.