mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[WebsocketController] use a new NotJoinedError
This commit is contained in:
parent
4cb8cc4a85
commit
0462e3e437
2 changed files with 11 additions and 4 deletions
|
@ -50,6 +50,12 @@ class NotAuthorizedError extends OError {
|
|||
}
|
||||
}
|
||||
|
||||
class NotJoinedError extends OError {
|
||||
constructor() {
|
||||
super('no project_id found on client')
|
||||
}
|
||||
}
|
||||
|
||||
class NullBytesInOpError extends OError {
|
||||
constructor(jsonChange) {
|
||||
super('null bytes found in op', { jsonChange })
|
||||
|
@ -76,6 +82,7 @@ module.exports = {
|
|||
DocumentUpdaterRequestFailedError,
|
||||
MissingSessionError,
|
||||
NotAuthorizedError,
|
||||
NotJoinedError,
|
||||
NullBytesInOpError,
|
||||
UpdateTooLargeError,
|
||||
WebApiRequestFailedError
|
||||
|
|
|
@ -9,7 +9,7 @@ const DocumentUpdaterManager = require('./DocumentUpdaterManager')
|
|||
const ConnectedUsersManager = require('./ConnectedUsersManager')
|
||||
const WebsocketLoadBalancer = require('./WebsocketLoadBalancer')
|
||||
const RoomManager = require('./RoomManager')
|
||||
const { NotAuthorizedError } = require('./Errors')
|
||||
const { NotAuthorizedError, NotJoinedError } = require('./Errors')
|
||||
|
||||
let WebsocketController
|
||||
module.exports = WebsocketController = {
|
||||
|
@ -158,7 +158,7 @@ module.exports = WebsocketController = {
|
|||
metrics.inc('editor.join-doc')
|
||||
const { project_id, user_id, is_restricted_user } = client.ol_context
|
||||
if (!project_id) {
|
||||
return callback(new Error('no project_id found on client'))
|
||||
return callback(new NotJoinedError())
|
||||
}
|
||||
logger.log(
|
||||
{ user_id, project_id, doc_id, fromVersion, client_id: client.id },
|
||||
|
@ -424,7 +424,7 @@ module.exports = WebsocketController = {
|
|||
return callback(null, [])
|
||||
}
|
||||
if (!project_id) {
|
||||
return callback(new Error('no project_id found on client'))
|
||||
return callback(new NotJoinedError())
|
||||
}
|
||||
logger.log(
|
||||
{ user_id, project_id, client_id: client.id },
|
||||
|
@ -459,7 +459,7 @@ module.exports = WebsocketController = {
|
|||
// client may have disconnected, but we can submit their update to doc-updater anyways.
|
||||
const { user_id, project_id } = client.ol_context
|
||||
if (!project_id) {
|
||||
return callback(new Error('no project_id found on client'))
|
||||
return callback(new NotJoinedError())
|
||||
}
|
||||
|
||||
WebsocketController._assertClientCanApplyUpdate(
|
||||
|
|
Loading…
Reference in a new issue