Skip to content

Commit 1ddf39a

Browse files
committed
fix(R): display WindowsArmX64RError in quarto check
Catch WindowsArmX64RError in knitrCb before withSpinner can swallow it, then display the custom error message instead of the generic message. This ensures users see the helpful x64-on-ARM error with download links instead of "Please check your installation of R."
1 parent 3cf11ab commit 1ddf39a

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

src/execute/rmd.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
knitrCapabilitiesMessage,
2727
knitrInstallationMessage,
2828
rInstallationMessage,
29+
WindowsArmX64RError,
2930
} from "../core/knitr.ts";
3031
import {
3132
DependenciesOptions,
@@ -139,13 +140,23 @@ title: "Title"
139140
const kMessage = "Checking R installation...........";
140141
let caps: KnitrCapabilities | undefined;
141142
let rBin: string | undefined;
143+
let x64ArmError: WindowsArmX64RError | undefined;
142144
const json: Record<string, unknown> = {};
143145
if (conf.jsonResult) {
144146
(conf.jsonResult.tools as Record<string, unknown>).knitr = json;
145147
}
146148
const knitrCb = async () => {
147149
rBin = await checkRBinary();
148-
caps = await knitrCapabilities(rBin);
150+
try {
151+
caps = await knitrCapabilities(rBin);
152+
} catch (e) {
153+
if (e instanceof WindowsArmX64RError) {
154+
x64ArmError = e;
155+
// Don't rethrow - let caps stay undefined but capture error
156+
} else {
157+
throw e; // Rethrow other errors
158+
}
159+
}
149160
};
150161
if (conf.jsonResult) {
151162
await knitrCb();
@@ -205,6 +216,16 @@ title: "Title"
205216
checkInfoMsg(msg);
206217
json["installed"] = false;
207218
checkInfoMsg("");
219+
} else if (x64ArmError) {
220+
// x64 R on Windows ARM detected - show specific error
221+
json["installed"] = false;
222+
checkCompleteMessage(kMessage + "(None)\n");
223+
const errorLines = x64ArmError.message.split("\n");
224+
errorLines.forEach((line) => {
225+
checkInfoMsg(line);
226+
});
227+
json["error"] = x64ArmError.message;
228+
checkInfoMsg("");
208229
} else if (caps === undefined) {
209230
json["installed"] = false;
210231
checkCompleteMessage(kMessage + "(None)\n");

0 commit comments

Comments
 (0)