mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-24 03:33:27 +00:00
change error handling on spelling
This commit is contained in:
parent
084b0d8548
commit
5e19d710ba
1 changed files with 5 additions and 3 deletions
|
@ -2,13 +2,15 @@ request = require 'request'
|
|||
Settings = require 'settings-sharelatex'
|
||||
logger = require 'logger-sharelatex'
|
||||
|
||||
TEN_SECONDS = 1000 * 10
|
||||
|
||||
module.exports = SpellingController =
|
||||
proxyRequestToSpellingApi: (req, res, next) ->
|
||||
url = req.url.slice("/spelling".length)
|
||||
url = "/user/#{req.session.user._id}#{url}"
|
||||
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.on "error", (error) ->
|
||||
request(url: Settings.apis.spelling.url + url, method: req.method, headers: req.headers, json: req.body, timeout:TEN_SECONDS)
|
||||
.on "error", (error) ->
|
||||
logger.error err: error, "Spelling API error"
|
||||
res.sendStatus 500
|
||||
getReq.pipe(res)
|
||||
.pipe(res)
|
||||
|
|
Loading…
Reference in a new issue