app: return 500 -> 404 when error happens
This commit is contained in:
parent
719382d812
commit
09a616d2b8
|
|
@ -9,6 +9,6 @@ module.exports = async (ctx, next) => {
|
|||
'Content-Type': 'text/html; charset=UTF-8',
|
||||
});
|
||||
ctx.body = `RSSHub 发生了一些意外: <pre>${err instanceof Error ? err.stack : err}</pre>`;
|
||||
ctx.status = 500;
|
||||
ctx.status = 404;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ module.exports = async (ctx) => {
|
|||
const id = ctx.params.id;
|
||||
|
||||
if (!getToken()) {
|
||||
ctx.throw(500);
|
||||
return;
|
||||
throw 'pixiv not login';
|
||||
}
|
||||
|
||||
const [bookmarksResponse, userDetailResponse] = await Promise.all([getBookmarks(id, getToken()), getUserDetail(id, getToken())]);
|
||||
|
|
|
|||
|
|
@ -36,8 +36,7 @@ module.exports = async (ctx) => {
|
|||
const date = ctx.params.date ? new Date(ctx.params.date) : new Date();
|
||||
|
||||
if (!getToken()) {
|
||||
ctx.throw(500);
|
||||
return;
|
||||
throw 'pixiv not login';
|
||||
}
|
||||
|
||||
const response = await getRanking(mode, ctx.params.date && date, getToken());
|
||||
|
|
|
|||
|
|
@ -5,8 +5,7 @@ module.exports = async (ctx) => {
|
|||
const id = ctx.params.id;
|
||||
|
||||
if (!getToken()) {
|
||||
ctx.throw(500);
|
||||
return;
|
||||
throw 'pixiv not login';
|
||||
}
|
||||
|
||||
const response = await getIllusts(id, getToken());
|
||||
|
|
|
|||
Loading…
Reference in New Issue