mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
82 lines
1.7 KiB
JavaScript
82 lines
1.7 KiB
JavaScript
const OError = require('@overleaf/o-error')
|
|
|
|
class ClientRequestedMissingOpsError extends OError {
|
|
constructor(statusCode) {
|
|
super('doc updater could not load requested ops', {
|
|
statusCode
|
|
})
|
|
}
|
|
}
|
|
|
|
class CodedError extends OError {
|
|
constructor(message, code) {
|
|
super(message, { code })
|
|
}
|
|
}
|
|
|
|
class CorruptedJoinProjectResponseError extends OError {
|
|
constructor() {
|
|
super('no data returned from joinProject request')
|
|
}
|
|
}
|
|
|
|
class DataTooLargeToParseError extends OError {
|
|
constructor(data) {
|
|
super('data too large to parse', {
|
|
head: data.slice(0, 1024),
|
|
length: data.length
|
|
})
|
|
}
|
|
}
|
|
|
|
class DocumentUpdaterRequestFailedError extends OError {
|
|
constructor(action, statusCode) {
|
|
super('doc updater returned a non-success status code', {
|
|
action,
|
|
statusCode
|
|
})
|
|
}
|
|
}
|
|
|
|
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 })
|
|
}
|
|
}
|
|
|
|
class WebApiRequestFailedError extends OError {
|
|
constructor(statusCode) {
|
|
super('non-success status code from web', { statusCode })
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
CodedError,
|
|
CorruptedJoinProjectResponseError,
|
|
ClientRequestedMissingOpsError,
|
|
DataTooLargeToParseError,
|
|
DocumentUpdaterRequestFailedError,
|
|
MissingSessionError,
|
|
NotAuthorizedError,
|
|
NullBytesInOpError,
|
|
UpdateTooLargeError,
|
|
WebApiRequestFailedError
|
|
}
|