Quiet the logs and capture the errors that were missing

- Activity page: "Delete all" empties the open tab (api/admin/logs/clear-logs,
  super admin only, logged under system)
- Stop logging every WebSocket connect
- Log unexpected API errors (safeErrorMessage -> logUnexpectedError), every
  failed bot job attempt and every job the queue lost
- Drop the cron jobs' console output; a failed model sync goes to the logs

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-25 05:11:31 +01:00
co-authored by Claude Opus 5.5
parent 3a9e57f682
commit e6c278198b
16 changed files with 245 additions and 47 deletions
+11 -1
View File
@@ -1,23 +1,33 @@
import AppError from "./app-error";
import logUnexpectedError from "@/src/functions/backend/log-unexpected-error";
type Params = {
error: unknown;
fallback?: string;
/**
* Write an unexpected error to the logs. Off where the caller already
* logs it.
*/
log?: boolean;
};
/**
* # Safe Error Message
* Returns the message of an `AppError` (deliberate, user-facing) and a
* generic fallback for everything else, so internal details (SQL errors,
* file paths, stack messages) never reach the client.
* file paths, stack messages) never reach the client. The unexpected ones
* are logged (`logUnexpectedError`), since the client never sees why.
*/
export default function safeErrorMessage({
error,
fallback = "Something went wrong. Please try again.",
log = true,
}: Params): string {
if (error instanceof AppError) {
return error.message;
}
if (log) logUnexpectedError({ error });
return fallback;
}