[SessionSockets] use a new MissingSessionError

This commit is contained in:
Jakob Ackermann 2020-08-20 11:38:10 +01:00
parent 6828becb46
commit de518ea4eb
2 changed files with 9 additions and 1 deletions

View file

@ -15,6 +15,12 @@ class DataTooLargeToParseError extends OError {
}
}
class MissingSessionError extends OError {
constructor() {
super('could not look up session by key')
}
}
class NullBytesInOpError extends OError {
constructor(jsonChange) {
super('null bytes found in op', { jsonChange })
@ -30,6 +36,7 @@ class UpdateTooLargeError extends OError {
module.exports = {
CodedError,
DataTooLargeToParseError,
MissingSessionError,
NullBytesInOpError,
UpdateTooLargeError
}

View file

@ -1,7 +1,8 @@
const { EventEmitter } = require('events')
const { MissingSessionError } = require('./Errors')
module.exports = function (io, sessionStore, cookieParser, cookieName) {
const missingSessionError = new Error('could not look up session by key')
const missingSessionError = new MissingSessionError()
const sessionSockets = new EventEmitter()
function next(error, socket, session) {