multer-error.js 659 B

123456789101112131415161718192021222324
  1. var util = require('util')
  2. var errorMessages = {
  3. LIMIT_PART_COUNT: 'Too many parts',
  4. LIMIT_FILE_SIZE: 'File too large',
  5. LIMIT_FILE_COUNT: 'Too many files',
  6. LIMIT_FIELD_KEY: 'Field name too long',
  7. LIMIT_FIELD_VALUE: 'Field value too long',
  8. LIMIT_FIELD_COUNT: 'Too many fields',
  9. LIMIT_UNEXPECTED_FILE: 'Unexpected field',
  10. MISSING_FIELD_NAME: 'Field name missing'
  11. }
  12. function MulterError (code, field) {
  13. Error.captureStackTrace(this, this.constructor)
  14. this.name = this.constructor.name
  15. this.message = errorMessages[code]
  16. this.code = code
  17. if (field) this.field = field
  18. }
  19. util.inherits(MulterError, Error)
  20. module.exports = MulterError