code: function HttpError(options) {
      assert.object(options, 'options');
  
      /**
       * Add the stack to the body
       *
       * @param {Boolean} asArray True if you want the stack as an array
       * @chainable
       * @return {HttpError}
       */
      this.withStack = function withStack(asArray) {
          this.body = this.body || {};
          if (asArray) {
              this.body.stack = stackToArray(this.stack);
          } else {
              this.body.stack = this.stack;
          }
          return this;
      };
  
      /**
       * Set the stack as an array
       *
       * @chainable
       * @return {HttpError}
       */
      this.toArray = function toArray() {
          if (this.body.stack) {
            this.body.stack = stackToArray(this.body.stack);
          }
          return this;
      };
  
      /**
       * Send the error to the logger
       *
       * @param {String} [mode = 'body'] If not equal to 'body' use message in default format
       * @chainable
       * @return {HttpError}
       */
      this.log = function log(mode) {
          if (config.logger && config.logger.error) {
              var msg = this.message;
              if ('function' === typeof config.format) {
                  msg = config.format(this, mode);
              }
              config.logger.error(msg);
          }
          return this;
      };
  
    options.constructorOpt = options.constructorOpt || HttpError;
      WError.apply(this, arguments);
  
      var self = this;
      var code = parseInt((options.statusCode || 500), 10);
      this.statusCode = code;
      this.body = options.body || {
          code: codeToErrorName(code),
          message: options.message || self.message
      };
      this.message = options.message || self.message;
  }
docs: /--- Error Base class