[misc] re-level log: 404 from web -> WARN and emit 'project not found'

A stale browser tab tried to join a deleted project.
Emitting 'project not found'/'ProjectNotFound' will trigger a page
 reload in the frontend, upon web can render a 404.
See frontend: ConnectionManager.joinProject callback
This commit is contained in:
Jakob Ackermann 2020-08-27 11:47:50 +01:00
parent 55d938ba14
commit 4960bdd6fe
3 changed files with 5 additions and 3 deletions

View file

@ -59,6 +59,8 @@ module.exports = {
) )
} else if (response.statusCode === 403) { } else if (response.statusCode === 403) {
callback(new NotAuthorizedError()) callback(new NotAuthorizedError())
} else if (response.statusCode === 404) {
callback(new CodedError('project not found', 'ProjectNotFound'))
} else { } else {
callback(new WebApiRequestFailedError(response.statusCode)) callback(new WebApiRequestFailedError(response.statusCode))
} }

View file

@ -282,7 +282,7 @@ describe('joinProject', function () {
}) })
it('should return an error', function () { it('should return an error', function () {
this.error.message.should.equal('Something went wrong in real-time service') this.error.code.should.equal('ProjectNotFound')
}) })
it('should not have joined the project room', function (done) { it('should not have joined the project room', function (done) {

View file

@ -130,8 +130,8 @@ describe('WebApiManager', function () {
this.callback this.callback
.calledWith( .calledWith(
sinon.match({ sinon.match({
message: 'non-success status code from web', message: 'project not found',
info: { statusCode: 404 } info: { code: 'ProjectNotFound' }
}) })
) )
.should.equal(true) .should.equal(true)