code: function E(sym, val, def, ...otherClasses) {
    // Special case for SystemError that formats the error message differently
    // The SystemErrors only have SystemError as their base classes.
    messages.set(sym, val);
    if (def === SystemError) {
      def = makeSystemErrorWithCode(sym);
    } else {
      def = makeNodeErrorWithCode(def, sym);
    }
  
    if (otherClasses.length !== 0) {
      otherClasses.forEach((clazz) => {
        def[clazz.name] = makeNodeErrorWithCode(clazz, sym);
      });
    }
    codes[sym] = def;
  }
docs: Utility function for registering the error codes. Only used here. Exported *only* to allow for testing.