Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/cli/src/cli/processor/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ export function createBasicTranslator(
settings: ModelSettings = {},
) {
return async (input: LocalizerInput, onProgress: LocalizerProgressFn) => {
try {
onProgress(0, {}, {});
} catch {}
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty catch block silences all errors without logging or handling them. If onProgress can fail, the error should be logged for debugging purposes. Consider logging the error with a descriptive message or removing the try-catch if onProgress is not expected to throw.

Suggested change
} catch {}
} catch (error) {
console.error("Error in onProgress callback at initial progress:", error);
}

Copilot uses AI. Check for mistakes.

const chunks = extractPayloadChunks(input.processableData);

const subResults: Record<string, any>[] = [];
Expand Down Expand Up @@ -79,9 +83,14 @@ export function createBasicTranslator(
],
});

const result = JSON.parse(response.text);

return result?.data || {};
let parsed: any;
try {
parsed = JSON.parse(response.text);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
throw new Error(`Failed to parse model response as JSON: ${message}`);
}
return parsed?.data || {};
}
}

Expand Down
Loading