mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 14:44:43 -04:00
Don't throw error if gitlab response is not okay-ish
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
03dc863f7f
commit
d7a3e0f58c
1 changed files with 6 additions and 2 deletions
|
@ -153,7 +153,9 @@ function gitlabActionProjects (req, res, note) {
|
||||||
id: req.user.id
|
id: req.user.id
|
||||||
}
|
}
|
||||||
}).then(function (user) {
|
}).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 }
|
const ret = { baseURL: config.gitlab.baseURL, version: config.gitlab.version }
|
||||||
ret.accesstoken = user.accessToken
|
ret.accesstoken = user.accessToken
|
||||||
ret.profileid = user.profileid
|
ret.profileid = user.profileid
|
||||||
|
@ -161,12 +163,14 @@ function gitlabActionProjects (req, res, note) {
|
||||||
fetch(apiUrl).then(resp => {
|
fetch(apiUrl).then(resp => {
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
res.send(ret)
|
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()
|
return resp.json()
|
||||||
}).then(body => {
|
}).then(body => {
|
||||||
ret.projects = body
|
ret.projects = body
|
||||||
return res.send(ret)
|
return res.send(ret)
|
||||||
|
}).catch(err => {
|
||||||
|
logger.error('gitlab action projects failed: ', err)
|
||||||
})
|
})
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
logger.error('gitlab action projects failed: ' + err)
|
logger.error('gitlab action projects failed: ' + err)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue