UnhandledSchemeError.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Ivan Kopeykin @vankop
  4. */
  5. "use strict";
  6. const makeSerializable = require("../util/makeSerializable");
  7. const WebpackError = require("./WebpackError");
  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. /** @type {string} */
  26. this.file = resource;
  27. /** @type {string} */
  28. this.name = "UnhandledSchemeError";
  29. }
  30. }
  31. makeSerializable(
  32. UnhandledSchemeError,
  33. "webpack/lib/errors/UnhandledSchemeError",
  34. "UnhandledSchemeError"
  35. );
  36. module.exports = UnhandledSchemeError;