mirror of
https://github.com/overleaf/overleaf.git
synced 2024-09-16 02:52:31 -04:00
49 lines
945 B
JavaScript
49 lines
945 B
JavaScript
const OError = require('@overleaf/o-error')
|
|
|
|
class CodedError extends OError {
|
|
constructor(message, code) {
|
|
super(message, { code })
|
|
}
|
|
}
|
|
|
|
class DataTooLargeToParseError extends OError {
|
|
constructor(data) {
|
|
super('data too large to parse', {
|
|
head: data.slice(0, 1024),
|
|
length: data.length
|
|
})
|
|
}
|
|
}
|
|
|
|
class MissingSessionError extends OError {
|
|
constructor() {
|
|
super('could not look up session by key')
|
|
}
|
|
}
|
|
|
|
class NotAuthorizedError extends OError {
|
|
constructor() {
|
|
super('not authorized')
|
|
}
|
|
}
|
|
|
|
class NullBytesInOpError extends OError {
|
|
constructor(jsonChange) {
|
|
super('null bytes found in op', { jsonChange })
|
|
}
|
|
}
|
|
|
|
class UpdateTooLargeError extends OError {
|
|
constructor(updateSize) {
|
|
super('update is too large', { updateSize })
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
CodedError,
|
|
DataTooLargeToParseError,
|
|
MissingSessionError,
|
|
NotAuthorizedError,
|
|
NullBytesInOpError,
|
|
UpdateTooLargeError
|
|
}
|