diff --git a/lib/response.js b/lib/response.js index 4d22d563d..44696a55f 100644 --- a/lib/response.js +++ b/lib/response.js @@ -153,7 +153,9 @@ function gitlabActionProjects (req, res, note) { id: req.user.id } }).then(function (user) { - if (!user) { return errors.errorNotFound(res) } + if (!user) { + return errors.errorNotFound(res) + } const ret = { baseURL: config.gitlab.baseURL, version: config.gitlab.version } ret.accesstoken = user.accessToken ret.profileid = user.profileid @@ -161,12 +163,14 @@ function gitlabActionProjects (req, res, note) { fetch(apiUrl).then(resp => { if (!resp.ok) { res.send(ret) - throw new Error('HTTP request returned not okay-ish status') + return Promise.reject(new Error('HTTP request returned not okay-ish status')) } return resp.json() }).then(body => { ret.projects = body return res.send(ret) + }).catch(err => { + logger.error('gitlab action projects failed: ', err) }) }).catch(function (err) { logger.error('gitlab action projects failed: ' + err)