refactor: remove explanatory comment and unspecified mode guard in differ adapter
This commit is contained in:
@@ -23,10 +23,7 @@ export function createDifferAdapter(
|
|||||||
throw new Error("differ: office step not found in ctx.steps (invariant violation)");
|
throw new Error("differ: office step not found in ctx.steps (invariant violation)");
|
||||||
}
|
}
|
||||||
|
|
||||||
const officeMeta = officeStep.meta as { mode: string; outputDocx: string; sourceDocx: string | null };
|
const officeMeta = officeStep.meta as { outputDocx: string; sourceDocx: string };
|
||||||
if (officeMeta.mode !== "edit" || officeMeta.sourceDocx === null) {
|
|
||||||
throw new Error("differ: office step is not in edit mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
const { outputDocx, sourceDocx } = officeMeta;
|
const { outputDocx, sourceDocx } = officeMeta;
|
||||||
const reportPath = join(dirname(outputDocx), "diff_report.html");
|
const reportPath = join(dirname(outputDocx), "diff_report.html");
|
||||||
@@ -40,7 +37,6 @@ export function createDifferAdapter(
|
|||||||
if (!result.ok) {
|
if (!result.ok) {
|
||||||
const e = result.error;
|
const e = result.error;
|
||||||
if (e.kind === "non_zero_exit" && e.exitCode === 1) {
|
if (e.kind === "non_zero_exit" && e.exitCode === 1) {
|
||||||
// exit 1 means "documents differ" — the normal success case for docx-diff
|
|
||||||
} else if (e.kind === "non_zero_exit") {
|
} else if (e.kind === "non_zero_exit") {
|
||||||
throw new Error(`differ: docx-diff failed (exit ${e.exitCode}): ${e.stderr}`);
|
throw new Error(`differ: docx-diff failed (exit ${e.exitCode}): ${e.stderr}`);
|
||||||
} else if (e.kind === "timeout") {
|
} else if (e.kind === "timeout") {
|
||||||
|
|||||||
Reference in New Issue
Block a user