Ted Wilmes created TINKERPOP-2290:
-------------------------------------

             Summary: Javascript GLV connection refused error handling
                 Key: TINKERPOP-2290
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2290
             Project: TinkerPop
          Issue Type: Bug
          Components: javascript
    Affects Versions: 3.4.1
            Reporter: Ted Wilmes


I believe the Javascript driver is emitting connection refused errors in a 
manner that makes it difficult for users to add in retry and other error 
handling logic. My Javascript knowledge is minimal so apologies if the below 
examples are non-idiomatic Javascript.

Here's an example of the error:
{code:java}
UNCAUGHT:  { Error: connect ECONNREFUSED 127.0.0.1:8182
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 8182 }
UNCAUGHT:  TypeError: Cannot read property 'aborted' of null
    at ClientRequest._req.on 
(/home/twilmes/repos/nodetest/node_modules/ws/lib/WebSocket.js:644:19)
    at emitOne (events.js:116:13)
    at ClientRequest.emit (events.js:211:7)
    at Socket.socketCloseListener (_http_client.js:363:9)
    at emitOne (events.js:121:20)
    at Socket.emit (events.js:211:7)
    at TCP._handle.close [as _onclose] (net.js:567:12) {code}
I did some looking at that UNCAUGHT TypeError is a separate issue and appears 
to be fixed in a newer version of the WS package that is being used.

To reproduce this problem, you can either start an application up and point it 
at a non-existant TP enabled DB (JanusGraph in my case) or turn the graph off 
while the application is running. After this is done, an error is logged but 
the only way I'm able to catch it is to do something like this:
{code:java}
 process.on('uncaughtException', function (err) {
   console.log("UNCAUGHT: ", err);
});{code}
Wrapping my queries and connection code in try/catch blocks does not catch 
anything.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to