code: function extendErrorBody(ctor) {
    /**
     * Parse errror's arguments to extract the 'options' object.
     * Extracted from https://github.com/restify/errors/blob/master/lib/helpers.js#L30
     * @param  {} ctorArgs Arguments of the error.
     */
    function parseOptions(ctorArgs) {
      function parse() {
        let options = null;
  
        if (_.isPlainObject(arguments[0])) {
          // See https://github.com/restify/errors#new-erroroptions--printf-args
          options = arguments[0] || {};
        } else if (
          arguments[0] instanceof Error &&
          _.isPlainObject(arguments[1])
        ) {
          // See https://github.com/restify/errors#new-errorpriorerr-options--printf-args
          options = arguments[1] || {};
        }
        return options;
      }
  
      // Calls constructor args.
      return parse.apply(null, ctorArgs);
    }
  
    /**
     * Dynamically create a constructor.
     * Must be anonymous fn.
     * @constructor
     */
    // Use an object because otherwise the variable name is shown as function name.
    const anonymous = {};
    anonymous.hook = function() {
      const options = parseOptions(arguments) || {};
      // Calls the parent constructor with itself as scope.
      ctor.apply(this, arguments);
      // Adds custom options to itself
      patchErrorBody(this, options);
    };
    // Inherits from the original error.
    // Is that necessary??
    util.inherits(anonymous.hook, ctor);
  
    // Make the prototype an instance of the old class.
    anonymous.hook.prototype = ctor.prototype;
  
    // Assign display name
    anonymous.hook.displayName = ctor.displayName + 'Hook';
  
    return anonymous.hook;
  }
docs: Adds cuostom options to the error body.
  @param  {function} ctor Original Cnstructor of the error.
  @return {function} Hooked constructor of the error.