mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-01 17:41:42 -05:00
63ff16843c
* [overleaf-editor-core] Introduce ScanOp and subclasses * [overleaf-editor-core] Remove unused methods * [overleaf-editor-core] Add tests for ScanOps * [overleaf-editor-core] Simplify merge * [overleaf-editor-core] Make ApplyContexts mutable * [overleaf-editor-core] Remove unnecessary containsNonBmpChars check * [overleaf-editor-core] Revert to using reduce * [overleaf-editor-core] Modify inputCursor after using it * [overleaf-editor-core] Rename DeleteOp to RemoveOp * [overleaf-editor-core] Remove useless constructor * [overleaf-editor-core] Mutate in mergeWith * [overleaf-editor-core] Add check for out-of-bounds retain * [overleaf-editor-core] Move error import GitOrigin-RevId: d07bd58177579638551257d56f087e8967e5b52f
37 lines
882 B
JavaScript
37 lines
882 B
JavaScript
const OError = require('@overleaf/o-error')
|
|
|
|
class UnprocessableError extends OError {}
|
|
|
|
class ApplyError extends UnprocessableError {
|
|
constructor(message, operation, operand) {
|
|
super(message, { operation, operand })
|
|
this.operation = operation
|
|
this.operand = operand
|
|
}
|
|
}
|
|
|
|
class InvalidInsertionError extends UnprocessableError {
|
|
constructor(str, operation) {
|
|
super('inserted text contains non BMP characters', { str, operation })
|
|
this.str = str
|
|
this.operation = operation
|
|
}
|
|
}
|
|
|
|
class TooLongError extends UnprocessableError {
|
|
constructor(operation, resultLength) {
|
|
super(`resulting string would be too long: ${resultLength}`, {
|
|
operation,
|
|
resultLength,
|
|
})
|
|
this.operation = operation
|
|
this.resultLength = resultLength
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
UnprocessableError,
|
|
ApplyError,
|
|
InvalidInsertionError,
|
|
TooLongError,
|
|
}
|