Skip to content

Commit 18b393a

Browse files
committed
fix: prevent duplicate Windows ARM x64 R error message
Use errorOnce() instead of rethrowing WindowsArmX64RError to prevent duplicate error messages when printCallRDiagnostics() calls knitrCapabilities() again. This scoped fix: - Only affects WindowsArmX64RError handling - Returns undefined like other knitrCapabilities errors - Doesn't change general error handling in callR()
1 parent ef0d613 commit 18b393a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/core/knitr.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { rBinaryPath, resourcePath } from "./resources.ts";
1111
import { readYamlFromString } from "./yaml.ts";
1212
import { coerce, satisfies } from "semver/mod.ts";
1313
import { debug } from "../deno_ral/log.ts";
14+
import { errorOnce } from "./log.ts";
1415

1516
export interface KnitrCapabilities {
1617
versionMajor: number;
@@ -147,9 +148,10 @@ export async function knitrCapabilities(rBin: string | undefined) {
147148
return undefined;
148149
}
149150
} catch (e) {
150-
// Rethrow x64-on-ARM errors - these have helpful messages
151+
// Log x64-on-ARM errors once, then return undefined like other errors
151152
if (e instanceof WindowsArmX64RError) {
152-
throw e;
153+
errorOnce(e.message);
154+
return undefined;
153155
}
154156
debug(
155157
`\n++ Error while running 'capabilities/knitr.R' ${

0 commit comments

Comments
 (0)