mirror of
https://github.com/wassname/Open-Assistant.git
synced 2026-09-11 11:50:17 +08:00
Merge pull request #970 from othrayte/improve-e2e-test-reliability
website: Improve reliability of e2e tests
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
import { withoutRole } from "src/lib/auth";
|
||||
import { ERROR_CODES } from "src/lib/constants";
|
||||
import { OasstError } from "src/lib/oasst_api_client";
|
||||
import { createApiClientFromUser } from "src/lib/oasst_client_factory";
|
||||
import prisma from "src/lib/prismadb";
|
||||
import { getBackendUserCore, getUserLanguage } from "src/lib/users";
|
||||
@@ -22,8 +24,12 @@ const handler = withoutRole("banned", async (req, res, token) => {
|
||||
try {
|
||||
task = await oasstApiClient.fetchTask(task_type as string, user, userLanguage);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
res.status(500).json(err);
|
||||
if (err instanceof OasstError && err.errorCode === ERROR_CODES.TASK_REQUESTED_TYPE_NOT_AVAILABLE) {
|
||||
res.status(503).json({});
|
||||
} else {
|
||||
console.error(err);
|
||||
res.status(500).json(err);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user