Errors.js 534 B

123456789101112131415161718192021222324
  1. const OError = require('@overleaf/o-error')
  2. class CodedError extends OError {
  3. constructor(message, code) {
  4. super(message, { code })
  5. }
  6. }
  7. class DataTooLargeToParseError extends OError {
  8. constructor(data) {
  9. super('data too large to parse', {
  10. head: data.slice(0, 1024),
  11. length: data.length
  12. })
  13. }
  14. }
  15. class UpdateTooLargeError extends OError {
  16. constructor(updateSize) {
  17. super('update is too large', { updateSize })
  18. }
  19. }
  20. module.exports = { CodedError, DataTooLargeToParseError, UpdateTooLargeError }