[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:
Jakob Ackermann 2020-08-27 10:55:13 +01:00
parent d2a2b9d46e
commit 884b340c75
3 changed files with 5 additions and 5 deletions

View file

@ -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))
}

View file

@ -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) {

View file

@ -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)