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

responseHandler - no error but response.statusCode > 300 #9

Open
carlostighe opened this issue Mar 12, 2015 · 0 comments
Open

responseHandler - no error but response.statusCode > 300 #9

carlostighe opened this issue Mar 12, 2015 · 0 comments

Comments

@carlostighe
Copy link

I have come across an issue whereby my node is throwing this error:

if (error.code == "ECONNREFUSED") {
           ^
TypeError: Cannot read property 'code' of null

Doing some quick debugging shows that the error is null but that the response code is 400.
This causes an the app to crash in client.js line 43.
Looking at my own code I think I might have some misformed sparql queries but I thought I'd raise the issue anyway, for possible greater error handling.

    var responseHandler = function responseHandler(error, response, responseBody, callback) {
        var continuation = emptyFn;
        if (error || response.statusCode >= 300) {
            var err;

            if (error.code == "ECONNREFUSED") {
                err = "Could not connect to SPARQL endpoint.";
            }
            else {
                err = "SparQL query failed.";
            }

            continuation = nextTick(callback, [
                new Error(err),
                null
            ], that);
        }
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

No branches or pull requests

1 participant