diff --git a/middleware/onerror.js b/middleware/onerror.js index 60a19acbd..3deac1980 100644 --- a/middleware/onerror.js +++ b/middleware/onerror.js @@ -9,6 +9,6 @@ module.exports = async (ctx, next) => { 'Content-Type': 'text/html; charset=UTF-8', }); ctx.body = `RSSHub 发生了一些意外:
${err instanceof Error ? err.stack : err}`;
- ctx.status = 500;
+ ctx.status = 404;
}
};
diff --git a/routes/pixiv/bookmarks.js b/routes/pixiv/bookmarks.js
index a75aebad6..5e0d8af00 100644
--- a/routes/pixiv/bookmarks.js
+++ b/routes/pixiv/bookmarks.js
@@ -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())]);
diff --git a/routes/pixiv/ranking.js b/routes/pixiv/ranking.js
index 68b231ca2..fbabc718d 100644
--- a/routes/pixiv/ranking.js
+++ b/routes/pixiv/ranking.js
@@ -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());
diff --git a/routes/pixiv/user.js b/routes/pixiv/user.js
index c062368a6..374583654 100644
--- a/routes/pixiv/user.js
+++ b/routes/pixiv/user.js
@@ -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());