lib/driver.js
function (driver, response, remote, options, deferred) {
      // Provide a default error handler to prevent hangs.
      if (!remote.onError) {
        remote.onError = function (request, remote, options, deferred, data) {
          data = JSON.parse(data);
          var value = -1;
          if (typeof data.value.message === 'string') {
            var msg = JSON.parse(data.value.message);
            value = msg.errorMessage;
          }
          deferred.resolve(JSON.stringify({'sessionId': data.sessionId, value: value}));
        };
      }
      remote.onError.call(this, response, remote, options, deferred, this.data);
      return this;
    }
function (driver, response, remote, options, deferred) {
      // Provide a default error handler to prevent hangs.
      if (!remote.onError) {
        remote.onError = function (request, remote, options, deferred, data) {
          data = JSON.parse(data);
          var value = -1;
          if (typeof data.value.message === 'string') {
            var msg = JSON.parse(data.value.message);
            value = msg.errorMessage;
          }
          deferred.resolve(JSON.stringify({'sessionId': data.sessionId, value: value}));
        };
      }
      remote.onError.call(this, response, remote, options, deferred, this.data);
      return this;
    }
function ( driver , response , remote , options , deferred ) { // Provide a default error handler to prevent hangs. if ( ! remote . onError ) { remote . onError = function ( request , remote , options , deferred , data ) { data = JSON . parse ( data ) ; var value = - 1 ; if ( typeof data . value . message === 'string' ) { var msg = JSON . parse ( data . value . message ) ; value = msg . errorMessage ; } deferred . resolve ( JSON . stringify ( { 'sessionId' : data . sessionId , value : value } ) ) ; } ; } remote . onError . call ( this , response , remote , options , deferred , this . data ) ; return this ; }
On error callback function

@method _onError
@param {DalekJs.Internal.Driver} driver Driver instance
@param {object} response Response from the webdriver server
@param {object} remote Dummy request body (function name, url, method)
@param {object} options Request options (method, port, path, headers, etc.)
@param {object} deferred Webdriver command deferred
@chainable
@private
On error callback function