for spelling attach error handler first

This commit is contained in:
Henry Oswald 2015-10-20 09:55:12 +01:00
parent f61d97a4f6
commit 79a694b5c8

View file

@ -8,7 +8,7 @@ module.exports = SpellingController =
url = "/user/#{req.session.user._id}#{url}" url = "/user/#{req.session.user._id}#{url}"
req.headers["Host"] = Settings.apis.spelling.host req.headers["Host"] = Settings.apis.spelling.host
getReq = request(url: Settings.apis.spelling.url + url, method: req.method, headers: req.headers, json: req.body) getReq = request(url: Settings.apis.spelling.url + url, method: req.method, headers: req.headers, json: req.body)
getReq.pipe(res)
getReq.on "error", (error) -> getReq.on "error", (error) ->
logger.error err: error, "Spelling API error" logger.error err: error, "Spelling API error"
res.sendStatus 500 res.sendStatus 500
getReq.pipe(res)