log institutions API errors

This commit is contained in:
Tim Alby 2018-08-17 15:13:24 +02:00
parent f5513f36ca
commit 8d6505b518
2 changed files with 3 additions and 1 deletions

View file

@ -80,6 +80,8 @@ makeAffiliationRequest = (requestOptions, callback = (error) ->) ->
errorMessage = "#{response.statusCode}: #{body.errors}"
else
errorMessage = "#{requestOptions.defaultErrorMessage}: #{response.statusCode}"
logger.err path: requestOptions.path, body: requestOptions.body, errorMessage
return callback(new Error(errorMessage))
callback(null, body)

View file

@ -20,7 +20,7 @@ describe "UserCreator", ->
@addAffiliation = sinon.stub().yields()
@UserCreator = SandboxedModule.require modulePath, requires:
"../../models/User": User:@UserModel
"logger-sharelatex":{log:->}
"logger-sharelatex":{ log: sinon.stub(), err: sinon.stub() }
'metrics-sharelatex': {timeAsyncMethod: ()->}
"../Institutions/InstitutionsAPI": addAffiliation: @addAffiliation