FormidableError.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. const missingPlugin = 1000;
  2. const pluginFunction = 1001;
  3. const aborted = 1002;
  4. const noParser = 1003;
  5. const uninitializedParser = 1004;
  6. const filenameNotString = 1005;
  7. const maxFieldsSizeExceeded = 1006;
  8. const maxFieldsExceeded = 1007;
  9. const smallerThanMinFileSize = 1008;
  10. const biggerThanTotalMaxFileSize = 1009;
  11. const noEmptyFiles = 1010;
  12. const missingContentType = 1011;
  13. const malformedMultipart = 1012;
  14. const missingMultipartBoundary = 1013;
  15. const unknownTransferEncoding = 1014;
  16. const maxFilesExceeded = 1015;
  17. const biggerThanMaxFileSize = 1016;
  18. const pluginFailed = 1017;
  19. const cannotCreateDir = 1018;
  20. const FormidableError = class extends Error {
  21. constructor(message, internalCode, httpCode = 500) {
  22. super(message);
  23. this.code = internalCode;
  24. this.httpCode = httpCode;
  25. }
  26. };
  27. export {
  28. missingPlugin,
  29. pluginFunction,
  30. aborted,
  31. noParser,
  32. uninitializedParser,
  33. filenameNotString,
  34. maxFieldsSizeExceeded,
  35. maxFieldsExceeded,
  36. maxFilesExceeded,
  37. smallerThanMinFileSize,
  38. biggerThanMaxFileSize,
  39. noEmptyFiles,
  40. missingContentType,
  41. malformedMultipart,
  42. missingMultipartBoundary,
  43. unknownTransferEncoding,
  44. biggerThanTotalMaxFileSize,
  45. pluginFailed,
  46. cannotCreateDir,
  47. };
  48. export default FormidableError;