Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No error handling when database is down. #130

Open
ghost opened this issue Jul 29, 2014 · 6 comments
Open

No error handling when database is down. #130

ghost opened this issue Jul 29, 2014 · 6 comments

Comments

@ghost
Copy link

ghost commented Jul 29, 2014

Not sure if this has been raised before, but I believe the aren't handlers for when the you can't connect to the database (ie. you turn the database off).

No error is given, it just produces an unhanded exception.

I managed to solve this using request by dealing with the ENOCONNECT response from the neo4j api before doing anything else.

@aseemk
Copy link
Member

aseemk commented Jul 29, 2014

The unhandled exception is on purpose / by design (but we do set a helpful error message):

https://github.com/thingdom/node-neo4j/blob/1.1.0/lib/util.coffee#L103-L104

(I'm curious why ENOCONNECT is what you check for though. In all of our testing and experience, the error code is always ECONNREFUSED.)

What alternate behavior do you think might make sense?

@ghost
Copy link
Author

ghost commented Jul 29, 2014

I was expecting the error to be passed along the error parameter. Feels to
me it would make more sense since we are dealing with the neo4j api as an
external resource so it shouldn't throw unhandled exceptions into our
program.

And you are right, it was ECONNREFUSED, I was typing that from memory.
On 30/07/2014 12:22 am, "Aseem Kishore" [email protected] wrote:

The unhandled exception is on purpose / by design (but we do set a helpful
error message):

https://github.com/thingdom/node-neo4j/blob/1.1.0/lib/util.coffee#L103-L104

(I'm curious why ENOCONNECT is what you check for though. In all of our
testing and experience, the error code is always ECONNREFUSED.)

What alternate behavior do you think might make sense?


Reply to this email directly or view it on GitHub
#130 (comment).

@aseemk
Copy link
Member

aseemk commented Jul 30, 2014

Oh, sorry for being unclear — the error is meant to be passed as the async error param. That's not what's happening for you? You're getting a (synchronously) thrown error?

Can you tell me how to repro this? If I simply stop Neo4j and attempt to talk to it with node-neo4j, I don't get a synchronously thrown error.

@ghost
Copy link
Author

ghost commented Jul 30, 2014

I pretty much took this from the demo. On query it would throw a sync
exception.

api.graph = function (query, data, callback) {

    var result, db,
        stringQuery = query.join('\n');

    db = new neo4j.GraphDatabase(api.config.neo4j.url);
    db.query(stringQuery, data, function (err, res) {
        err ? callback(err) : null;
        result = res !== undefined ?
            res.map(function (result) {
                return result;
            }): {};
        callback(null, result);
    })
};

On Wed, Jul 30, 2014 at 11:06 AM, Aseem Kishore [email protected]
wrote:

Oh, sorry for being unclear — the error is meant to be passed as the
async error param. That's not what's happening for you? You're getting a
(synchronously) thrown error?

Can you tell me how to repro this? If I simply stop Neo4j and attempt to
talk to it with node-neo4j, I don't get a synchronously thrown error.


Reply to this email directly or view it on GitHub
#130 (comment).

@aseemk aseemk added the bug label Aug 1, 2014
@aseemk
Copy link
Member

aseemk commented Aug 1, 2014

Thanks @pipechang. I will investigate when I get a chance.

@aseemk
Copy link
Member

aseemk commented Oct 12, 2015

Noting to self: need to investigate if this is still happening with v2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant