multer-error.js 615 B

1234567891011121314151617181920212223
  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. }
  11. function MulterError (code, field) {
  12. Error.captureStackTrace(this, this.constructor)
  13. this.name = this.constructor.name
  14. this.message = errorMessages[code]
  15. this.code = code
  16. if (field) this.field = field
  17. }
  18. util.inherits(MulterError, Error)
  19. module.exports = MulterError