UnhandledSchemeError.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Ivan Kopeykin @vankop
  4. */
  5. "use strict";
  6. const WebpackError = require("./WebpackError");
  7. const makeSerializable = require("./util/makeSerializable");
  8. /**
  9. * Error raised when webpack encounters a resource URI scheme that no installed
  10. * plugin knows how to read.
  11. */
  12. class UnhandledSchemeError extends WebpackError {
  13. /**
  14. * Creates an error explaining that the current resource scheme is not
  15. * supported by the active plugin set.
  16. * @param {string} scheme scheme
  17. * @param {string} resource resource
  18. */
  19. constructor(scheme, resource) {
  20. super(
  21. `Reading from "${resource}" is not handled by plugins (Unhandled scheme).` +
  22. '\nWebpack supports "data:" and "file:" URIs by default.' +
  23. `\nYou may need an additional plugin to handle "${scheme}:" URIs.`
  24. );
  25. this.file = resource;
  26. /** @type {string} */
  27. this.name = "UnhandledSchemeError";
  28. }
  29. }
  30. makeSerializable(
  31. UnhandledSchemeError,
  32. "webpack/lib/UnhandledSchemeError",
  33. "UnhandledSchemeError"
  34. );
  35. module.exports = UnhandledSchemeError;