[WebsocketController] use the new NotAuthorizedError

This commit is contained in:
Jakob Ackermann 2020-08-20 11:50:43 +01:00
parent a8c51de510
commit 59c4c884a5

View file

@ -9,6 +9,7 @@ const DocumentUpdaterManager = require('./DocumentUpdaterManager')
const ConnectedUsersManager = require('./ConnectedUsersManager')
const WebsocketLoadBalancer = require('./WebsocketLoadBalancer')
const RoomManager = require('./RoomManager')
const { NotAuthorizedError } = require('./Errors')
let WebsocketController
module.exports = WebsocketController = {
@ -48,12 +49,7 @@ module.exports = WebsocketController = {
}
if (!privilegeLevel) {
const err = new Error('not authorized')
logger.warn(
{ err, project_id, user_id, client_id: client.id },
'user is not authorized to join project'
)
return callback(err)
return callback(new NotAuthorizedError())
}
client.ol_context = {}