docs: function (err) {
      "use strict";
  
      var message = '';
  
      if (typeof err === 'string') {
        return new Error(err);
  
      } else if (typeof err === 'object') {
  
        if (err.cause) {
          // probably a webdriver error
          try {
            message = JSON.parse(err.cause.value.message).errorMessage;
          } catch ($) {
            message = err.cause.value.message;
          }
        } else {
          message = err.message || err.toString();
        }
        return new Error(message);
      }
      return new Error(err.toString());
    }