فهرست منبع

[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
Jakob Ackermann 6 سال پیش
والد
کامیت
4960bdd6fe

+ 2 - 0
services/real-time/app/js/WebApiManager.js

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

+ 1 - 1
services/real-time/test/acceptance/js/JoinProjectTests.js

@@ -282,7 +282,7 @@ describe('joinProject', 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) {

+ 2 - 2
services/real-time/test/unit/js/WebApiManagerTests.js

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