Github user jorgebay commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/889#discussion_r201289328
  
    --- Diff: 
gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js
 ---
    @@ -151,7 +156,16 @@ class DriverRemoteConnection extends RemoteConnection {
           return;
         }
     
    -    if (response.status.code >= 400) {
    +    if (response.status.code === 
responseStatusCode.authenticationChallenge && this._authenticator) {
    +      this._authenticator.evaluateChallenge(response).then(res => {
    --- End diff --
    
    We can capture any possible error if we use a chained `catch()`, instead of 
`then()` with multiple callback functions:
    
    ```
    this._authenticator.evaluateChallenge(response)
      .then(() => {
        // Any possible error thrown or promise rejection will be captured 
        return this.submit('', 'authentication', res);
      })
      .catch(handler.callback)


---

Reply via email to