From 18cd1882f56554ec18e86e204ae31aee57b957bc Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Mon, 13 Apr 2026 09:06:43 -0400 Subject: [PATCH 1/4] Log all compile error messages to Output channel --- src/commands/compile.ts | 8 ++++---- .../FileSystemProvider/FileSystemProvider.ts | 2 +- src/utils/index.ts | 15 +++++++++++++-- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/commands/compile.ts b/src/commands/compile.ts index e7af69e1..06250f45 100644 --- a/src/commands/compile.ts +++ b/src/commands/compile.ts @@ -376,8 +376,8 @@ export async function compile(docs: (CurrentTextFile | CurrentBinaryFile)[], ask } return docs; }) - .catch(() => { - compileErrorMsg(); + .catch((error) => { + compileErrorMsg(error); // Always fetch server changes, even when compile failed or got cancelled return docs; }) @@ -550,7 +550,7 @@ export async function compileExplorerItems(nodes: NodeBase[]): Promise { throw new Error(`${info}Compile error`); } }) - .catch(() => compileErrorMsg()) + .catch((error) => compileErrorMsg(error)) ); } @@ -637,7 +637,7 @@ async function promptForCompile(imported: string[], api: AtelierAPI, isIsfs: boo throw new Error(`${info}Compile error`); } }) - .catch(() => compileErrorMsg()) + .catch((error) => compileErrorMsg(error)) .finally(() => { if (isIsfs) { // Refresh the files explorer to show the new files diff --git a/src/providers/FileSystemProvider/FileSystemProvider.ts b/src/providers/FileSystemProvider/FileSystemProvider.ts index 9afed7fc..aa3c320d 100644 --- a/src/providers/FileSystemProvider/FileSystemProvider.ts +++ b/src/providers/FileSystemProvider/FileSystemProvider.ts @@ -914,7 +914,7 @@ export class FileSystemProvider implements vscode.FileSystemProvider { } data.result.content.forEach((f) => filesToUpdate.push(f.name)); }) - .catch(() => compileErrorMsg()) + .catch((error) => compileErrorMsg(error)) ); if (file && (update || filesToUpdate.includes(file.fileName))) { // This file was just written and the write may have changed its contents or the diff --git a/src/utils/index.ts b/src/utils/index.ts index e9141e51..e3353c0a 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -72,7 +72,14 @@ export function stringifyError(error): string { : error instanceof Error ? error.toString() : JSON.stringify(error) - ).trim(); + ) + .trim() + // Unescape any HTML-escpaed characters + .replaceAll("&", "&") + .replaceAll("<", "<") + .replaceAll(">", ">") + .replaceAll(""", '"') + .replaceAll("'", "'"); } catch { // Need to catch errors from JSON.stringify() return ""; @@ -1017,7 +1024,11 @@ export async function replaceFile(uri: vscode.Uri, content: string | string[] | } /** Show the compilation failure error message if required. */ -export function compileErrorMsg(): void { +export function compileErrorMsg(error: any): void { + if (!(error instanceof Error && error.message.endsWith("Compile error"))) { + // Don't log the generic placeholder error + handleError(error); + } vscode.window .showErrorMessage( "Compilation failed. Check 'ObjectScript' Output channel for details.", From 11787f08c7f8ac6f8476beea1a62920a024d9583 Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Mon, 13 Apr 2026 10:29:34 -0400 Subject: [PATCH 2/4] Update index.ts --- src/utils/index.ts | 53 ++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index e3353c0a..a886e568 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -63,23 +63,25 @@ export function stringifyError(error): string { return errs.length ? `AggregateError:\n- ${errs.join("\n- ")}` : ""; } return ( - error == undefined - ? "" - : error.errorText - ? error.errorText - : typeof error == "string" - ? error - : error instanceof Error - ? error.toString() - : JSON.stringify(error) - ) - .trim() - // Unescape any HTML-escpaed characters - .replaceAll("&", "&") - .replaceAll("<", "<") - .replaceAll(">", ">") - .replaceAll(""", '"') - .replaceAll("'", "'"); + ( + error == undefined + ? "" + : error.errorText + ? error.errorText + : typeof error == "string" + ? error + : error instanceof Error + ? error.toString() + : JSON.stringify(error) + ) + .trim() + // Unescape any HTML-escpaed characters + .replaceAll("&", "&") + .replaceAll("<", "<") + .replaceAll(">", ">") + .replaceAll(""", '"') + .replaceAll("'", "'") + ); } catch { // Need to catch errors from JSON.stringify() return ""; @@ -1025,21 +1027,12 @@ export async function replaceFile(uri: vscode.Uri, content: string | string[] | /** Show the compilation failure error message if required. */ export function compileErrorMsg(error: any): void { - if (!(error instanceof Error && error.message.endsWith("Compile error"))) { + if (error instanceof Error && error.message.endsWith("Compile error")) { // Don't log the generic placeholder error - handleError(error); + handleError("", "Compilaton failed."); + } else { + handleError(error, "Compilaton failed."); } - vscode.window - .showErrorMessage( - "Compilation failed. Check 'ObjectScript' Output channel for details.", - !vscode.window.visibleTextEditors.some((e) => e.document.languageId == outputLangId) ? "Show" : undefined, - "Dismiss" - ) - .then((action) => { - if (action == "Show") { - outputChannel.show(true); - } - }); } /** Return a string containing the displayable form of `uri` */ From 16ca59feba04c0aacfcd31073a2e655e1ebe42f2 Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Mon, 13 Apr 2026 11:14:17 -0400 Subject: [PATCH 3/4] Update index.ts --- src/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index a886e568..8c3775cb 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -76,11 +76,11 @@ export function stringifyError(error): string { ) .trim() // Unescape any HTML-escpaed characters - .replaceAll("&", "&") .replaceAll("<", "<") .replaceAll(">", ">") .replaceAll(""", '"') .replaceAll("'", "'") + .replaceAll("&", "&") ); } catch { // Need to catch errors from JSON.stringify() From eb7f92d149037f440eec7395a07e691bf0273c8a Mon Sep 17 00:00:00 2001 From: Brett Saviano Date: Mon, 13 Apr 2026 12:53:27 -0400 Subject: [PATCH 4/4] Update index.ts --- src/utils/index.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 8c3775cb..2b84b2c6 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -1027,12 +1027,11 @@ export async function replaceFile(uri: vscode.Uri, content: string | string[] | /** Show the compilation failure error message if required. */ export function compileErrorMsg(error: any): void { - if (error instanceof Error && error.message.endsWith("Compile error")) { - // Don't log the generic placeholder error - handleError("", "Compilaton failed."); - } else { - handleError(error, "Compilaton failed."); - } + handleError( + // Don't log the generic placeholder error if that's all we have + error instanceof Error && error.message.endsWith("Compile error") ? "" : error, + "Compilaton failed." + ); } /** Return a string containing the displayable form of `uri` */