mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
fix unhandled exception in ProjectDetailsHandler
This commit is contained in:
parent
30c5bbfdfc
commit
4e66b045e3
2 changed files with 8 additions and 1 deletions
|
@ -10,7 +10,7 @@ module.exports =
|
|||
|
||||
getDetails: (project_id, callback)->
|
||||
ProjectGetter.getProject project_id, {name:true, description:true, compiler:true, features:true, owner_ref:true}, (err, project)->
|
||||
if err?
|
||||
if err? or !project?
|
||||
logger.err err:err, project_id:project_id, "error getting project"
|
||||
return callback(err)
|
||||
UserGetter.getUser project.owner_ref, (err, user) ->
|
||||
|
|
|
@ -48,6 +48,13 @@ describe 'ProjectDetailsHandler', ->
|
|||
assert.equal(details.something, undefined)
|
||||
done()
|
||||
|
||||
it "should return an error for a non-existent project", (done)->
|
||||
@ProjectGetter.getProject.callsArg(2, null, null)
|
||||
@handler.getDetails "0123456789012345678901234", (err, details)=>
|
||||
assert.equal(err, undefined)
|
||||
assert.equal(details, undefined)
|
||||
done()
|
||||
|
||||
it "should return the error", (done)->
|
||||
error = "some error"
|
||||
@ProjectGetter.getProject.callsArgWith(2, error)
|
||||
|
|
Loading…
Reference in a new issue