From db1288c876e5856e9a5d9d6773e3ae846e375d16 Mon Sep 17 00:00:00 2001 From: Charlie Drage Date: Tue, 3 Sep 2024 09:21:28 -0400 Subject: [PATCH] chore: add debugging / error information to log file as well ### What does this PR do? Adds some simple code that also outputs any errors with the function to the log file for debugging purposes / being able to help for any debugging. ### Screenshot / video of UI N/A ### What issues does this PR fix or reference? Closes https://github.com/containers/podman-desktop-extension-bootc/issues/678 ### How to test this PR? 1. Before pressing build, stop your Podman Machine 2. See that it outputs the connection error into the build log file. Signed-off-by: Charlie Drage --- packages/backend/src/build-disk-image.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/backend/src/build-disk-image.ts b/packages/backend/src/build-disk-image.ts index 09e7a1a2..45d9e054 100644 --- a/packages/backend/src/build-disk-image.ts +++ b/packages/backend/src/build-disk-image.ts @@ -280,6 +280,11 @@ export async function buildDiskImage(build: BootcBuildInfo, history: History, ov errorMessage = (error as Error).message; console.error(error); telemetryData.error = error; + + // Append the error to the file as well for debugging purposes, but do not worry if it fails / errors out the build. + await fs.promises.appendFile(logPath, errorMessage).catch((error: unknown) => { + console.debug('Could not write error to bootc build log: ', error); + }); } finally { // ########### // # CLEANUP #