mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
[misc] re-level log: 403 from web goes to WARN and emit 'not authorized'
Users will get redirected to the login page and will see a 'restricted' page after logging in again. See frontend: ConnectionManager.reportConnectionError
This commit is contained in:
@@ -8,6 +8,7 @@ const logger = require('logger-sharelatex')
|
||||
const {
|
||||
CodedError,
|
||||
CorruptedJoinProjectResponseError,
|
||||
NotAuthorizedError,
|
||||
WebApiRequestFailedError
|
||||
} = require('./Errors')
|
||||
|
||||
@@ -56,6 +57,8 @@ module.exports = {
|
||||
'TooManyRequests'
|
||||
)
|
||||
)
|
||||
} else if (response.statusCode === 403) {
|
||||
callback(new NotAuthorizedError())
|
||||
} else {
|
||||
callback(new WebApiRequestFailedError(response.statusCode))
|
||||
}
|
||||
|
||||
@@ -221,9 +221,7 @@ describe('joinProject', function () {
|
||||
})
|
||||
|
||||
it('should return an error', function () {
|
||||
this.error.message.should.equal(
|
||||
'Something went wrong in real-time service'
|
||||
)
|
||||
this.error.message.should.equal('not authorized')
|
||||
})
|
||||
|
||||
it('should not have joined the project room', function (done) {
|
||||
|
||||
@@ -107,8 +107,7 @@ describe('WebApiManager', function () {
|
||||
this.callback
|
||||
.calledWith(
|
||||
sinon.match({
|
||||
message: 'non-success status code from web',
|
||||
info: { statusCode: 403 }
|
||||
message: 'not authorized'
|
||||
})
|
||||
)
|
||||
.should.equal(true)
|
||||
|
||||
Reference in New Issue
Block a user