webidl2js-wrapper.js
 1  "use strict";
 2  const DOMException = require("./lib/DOMException.js");
 3  
 4  // Special install function to make the DOMException inherit from Error.
 5  // https://heycam.github.io/webidl/#es-DOMException-specialness
 6  function installOverride(globalObject) {
 7    if (typeof globalObject.Error !== "function") {
 8      throw new Error("Internal error: Error constructor is not present on the given global object.");
 9    }
10  
11    DOMException.install(globalObject);
12    Object.setPrototypeOf(globalObject.DOMException.prototype, globalObject.Error.prototype);
13  }
14  
15  module.exports = {...DOMException, install: installOverride };