overleaf/libraries/overleaf-editor-core/lib/errors.js
Eric Mc Sween 97b62e01f8 Merge pull request #19851 from overleaf/em-user-content-logging
Avoid logging user content when errors occur in history

GitOrigin-RevId: 0326065a15dfc30155847100bb5a077efea771b5
2024-08-12 08:04:59 +00:00

34 lines
793 B
JavaScript

const OError = require('@overleaf/o-error')
class UnprocessableError extends OError {}
class ApplyError extends UnprocessableError {
constructor(message, operation, operand) {
super(message)
this.operation = operation
this.operand = operand
}
}
class InvalidInsertionError extends UnprocessableError {
constructor(str, operation) {
super('inserted text contains non BMP characters')
this.str = str
this.operation = operation
}
}
class TooLongError extends UnprocessableError {
constructor(operation, resultLength) {
super('resulting string would be too long', { resultLength })
this.operation = operation
this.resultLength = resultLength
}
}
module.exports = {
UnprocessableError,
ApplyError,
InvalidInsertionError,
TooLongError,
}