mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 07:38:20 -05:00
Handle a couple errors I saw in the logs
This commit is contained in:
parent
4172f03fad
commit
d0be5c1f22
3 changed files with 10 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -104,3 +104,4 @@ Dockerfile
|
|||
|
||||
# coffeelint for editors (might be standardized eventually)
|
||||
coffeelint.json
|
||||
gitSpy/*
|
||||
|
|
|
@ -18,7 +18,14 @@ PatchSchema.pre 'save', (next) ->
|
|||
return next(err)
|
||||
|
||||
collection = target.collection
|
||||
handler = require('../' + handlers[collection])
|
||||
try
|
||||
handler = require('../' + handlers[collection])
|
||||
catch err
|
||||
console.error 'Couldn\'t find handler for collection:', target.collection, 'from target', target
|
||||
err = new Error('Server error.')
|
||||
err.response = {message: '', property: 'target.id'}
|
||||
err.code = 500
|
||||
return next(err)
|
||||
handler.getDocumentForIdOrSlug targetID, (err, document) =>
|
||||
if err
|
||||
err = new Error('Server error.')
|
||||
|
|
|
@ -30,7 +30,7 @@ module.exports.sendResponseObject = (res, object) ->
|
|||
module.exports.formatSessionInformation = (session) ->
|
||||
heroID = if session.team is 'ogres' then 'hero-placeholder-1' else 'hero-placeholder'
|
||||
submittedCode = {}
|
||||
submittedCode[heroID] = plan: LZString.compressToUTF16 session.submittedCode[heroID].plan
|
||||
submittedCode[heroID] = plan: LZString.compressToUTF16(session.submittedCode[heroID]?.plan ? '')
|
||||
|
||||
_id: session._id
|
||||
sessionID: session._id
|
||||
|
|
Loading…
Reference in a new issue