docs: function makeError(constructor, super_) {
    if (super_ == null || super_ === Error) {
      super_ = BaseError;
    } else if (typeof super_ !== "function") {
      throw new TypeError("super_ should be a function");
    }
  
    var name;
    if (typeof constructor === "string") {
      name = constructor;
      constructor =
        construct !== undefined
          ? function() {
              return construct(super_, arguments, this.constructor);
            }
          : function() {
              super_.apply(this, arguments);
            };
  
      // If the name can be set, do it once and for all.
      if (setFunctionName !== undefined) {
        setFunctionName(constructor, name);
        name = undefined;
      }
    } else if (typeof constructor !== "function") {
      throw new TypeError("constructor should be either a string or a function");
    }
  
    // Also register the super constructor also as `constructor.super_` just
    // like Node's `util.inherits()`.
    constructor.super_ = constructor["super"] = super_;
  
    var properties = {
      constructor: {
        configurable: true,
        value: constructor,
        writable: true,
      },
    };
  
    // If the name could not be set on the constructor, set it on the
    // prototype.
    if (name !== undefined) {
      properties.name = {
        configurable: true,
        value: name,
        writable: true,
      };
    }
    constructor.prototype = Object.create(super_.prototype, properties);
  
    return constructor;
  }