mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(api): log only genuine processing faults at error level
The earlier worker error-logging change logged every job failure at error level, including expected InputValidationErrors (e.g. 'needs at least two audio files') -- flooding error logs with non-actionable user-input rejections (visible across the integration run). Skip validation errors (matched by name, which survives the BullMQ boundary); genuine faults still log at error, and all failures still reach the OTel span.
This commit is contained in:
@@ -340,9 +340,12 @@ async function processToolJob(job: Job<ToolJobData>): Promise<ToolJobResult> {
|
|||||||
? `Timed out after ${Math.round(timeoutMs / 1000)}s`
|
? `Timed out after ${Math.round(timeoutMs / 1000)}s`
|
||||||
: errorMessage;
|
: errorMessage;
|
||||||
|
|
||||||
// Keep the full error (incl. raw tool stderr) in server logs; clients only
|
// Log genuine processing faults at error level (clients only ever see
|
||||||
// ever see friendlyError(finalError).
|
// friendlyError(finalError)). Expected validation rejections -- bad user
|
||||||
if (!isCanceled && !isTimeout) {
|
// input, not a server fault -- would otherwise flood error logs, so skip
|
||||||
|
// them here; they still reach the OTel span recorded below.
|
||||||
|
const isValidationError = err instanceof Error && err.name === "InputValidationError";
|
||||||
|
if (!isCanceled && !isTimeout && !isValidationError) {
|
||||||
logger.error({ err, jobId, toolId: data.toolId }, "tool job failed");
|
logger.error({ err, jobId, toolId: data.toolId }, "tool job failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user