diff --git a/fresh.gen.ts b/fresh.gen.ts index cbca142..d0d2ec1 100644 --- a/fresh.gen.ts +++ b/fresh.gen.ts @@ -22,6 +22,7 @@ import * as $api_gallery_gid_ from "./routes/api/gallery/[gid].ts"; import * as $api_gallery_list from "./routes/api/gallery/list.ts"; import * as $api_gallery_meta_gids_ from "./routes/api/gallery/meta/[gids].ts"; import * as $api_health_check from "./routes/api/health_check.ts"; +import * as $api_log from "./routes/api/log.ts"; import * as $api_shared_token from "./routes/api/shared_token.ts"; import * as $api_shared_token_list from "./routes/api/shared_token/list.ts"; import * as $api_status from "./routes/api/status.ts"; @@ -72,6 +73,7 @@ const manifest = { "./routes/api/gallery/list.ts": $api_gallery_list, "./routes/api/gallery/meta/[gids].ts": $api_gallery_meta_gids_, "./routes/api/health_check.ts": $api_health_check, + "./routes/api/log.ts": $api_log, "./routes/api/shared_token.ts": $api_shared_token, "./routes/api/shared_token/list.ts": $api_shared_token_list, "./routes/api/status.ts": $api_status, diff --git a/routes/api/task.ts b/routes/api/task.ts index 5d41590..9af9c58 100644 --- a/routes/api/task.ts +++ b/routes/api/task.ts @@ -148,7 +148,8 @@ export const handler: Handlers = { } return return_data(task, 201); } catch (e) { - return return_error(500, e.message); + logger.error("Failed to add download task:", e); + return return_error(500, "Internal Server Error"); } } else if (typ == "export_zip") { const gid = await parse_big_int(form.get("gid"), null); @@ -168,7 +169,8 @@ export const handler: Handlers = { const task = await t.add_export_zip_task(gid, dcfg); return return_data(task, 201); } catch (e) { - return return_error(500, e.message); + logger.error("Failed to add export zip task:", e); + return return_error(500, "Internal Server Error"); } } else if (typ == "update_meili_search_data") { const gid = await parse_big_int(form.get("gid"), 0); @@ -176,7 +178,8 @@ export const handler: Handlers = { const task = await t.add_update_meili_search_data_task(gid); return return_data(task, 201); } catch (e) { - return return_error(500, e.message); + logger.error("Failed to add update meili search data task:", e); + return return_error(500, "Internal Server Error"); } } else if (typ == "import") { const gid = await parse_big_int(form.get("gid"), null); @@ -207,7 +210,8 @@ export const handler: Handlers = { } return return_data(task, 201); } catch (e) { - return return_error(500, e.message); + logger.error("Failed to add import task:", e); + return return_error(500, "Internal Server Error"); } } else if (typ == "update_tag_translation") { const cfg = await get_string(form.get("cfg")); @@ -229,7 +233,8 @@ export const handler: Handlers = { } return return_data(task, 201); } catch (e) { - return return_error(500, e.message); + logger.error("Failed to add update tag translation task:", e); + return return_error(500, "Internal Server Error"); } } else { return return_error(5, "unknown type");