Fix uncaught error when browsing non-existing repo
This commit is contained in:
parent
f703e09604
commit
2df7ec4e20
@ -24,6 +24,7 @@ export default class GiteaRepoLatestReleaseController extends Controller {
|
|||||||
data += c;
|
data += c;
|
||||||
});
|
});
|
||||||
r.on('end', () => {
|
r.on('end', () => {
|
||||||
|
try {
|
||||||
const assets = JSON.parse(data)[0].assets;
|
const assets = JSON.parse(data)[0].assets;
|
||||||
|
|
||||||
if (file) {
|
if (file) {
|
||||||
@ -37,6 +38,9 @@ export default class GiteaRepoLatestReleaseController extends Controller {
|
|||||||
log.debug('List files');
|
log.debug('List files');
|
||||||
return res.render('list-files', {assets: assets});
|
return res.render('list-files', {assets: assets});
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
return next(e);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}).on('error', err => {
|
}).on('error', err => {
|
||||||
log.error(err);
|
log.error(err);
|
||||||
|
Loading…
Reference in New Issue
Block a user