mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-02 05:41:33 +02:00
if blog or universities site is down don't crash, send 500
This commit is contained in:
@@ -22,9 +22,10 @@ module.exports = BlogController =
|
||||
|
||||
logger.log url:url, "proxying request to blog api"
|
||||
request.get blogUrl, (err, r, data)->
|
||||
return next(err) if err?
|
||||
if r?.statusCode == 404
|
||||
return ErrorController.notFound(req, res, next)
|
||||
if err?
|
||||
return res.send 500
|
||||
data = data.trim()
|
||||
try
|
||||
data = JSON.parse(data)
|
||||
|
||||
@@ -18,6 +18,8 @@ module.exports = UniversityController =
|
||||
request.get universityUrl, (err, r, data)->
|
||||
if r?.statusCode == 404
|
||||
return ErrorController.notFound(req, res, next)
|
||||
if err?
|
||||
return res.send 500
|
||||
data = data.trim()
|
||||
try
|
||||
data = JSON.parse(data)
|
||||
|
||||
Reference in New Issue
Block a user