function createErrorHandler(callback) {
  return function errorHandler(event) {
    if (!event || !event.error) {
      return callback(null);
    }
    if (event.error instanceof Error) {
      return callback(event.error);
    }
    // A non-error was thrown, we don't have a trace. :(
    // Look in your browser's devtools for more information
    return callback(new Error(event.error));
  };
}
Runs a callback with patched the DOM URL APIs.
@param {function(UrlAPIs): void} callback The code to run with patched URL globals.
@returns {void}