From 18f3b421068074b1a3aad6cb3aae60c34f42a512 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Mon, 8 Dec 2025 21:10:53 +0100 Subject: [PATCH] Added error handling and logging --- .../Dialogs/DocumentCheckDialog.razor.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor.cs b/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor.cs index 93a8bf19..39abd602 100644 --- a/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor.cs +++ b/app/MindWork AI Studio/Dialogs/DocumentCheckDialog.razor.cs @@ -33,10 +33,21 @@ public partial class DocumentCheckDialog : MSGComponentBase { if (firstRender && !string.IsNullOrWhiteSpace(this.FilePath)) { - var fileContent = await UserFile.LoadFileData(this.FilePath, this.RustService, this.DialogService); - this.FileContent = fileContent; - this.StateHasChanged(); + try + { + var fileContent = await UserFile.LoadFileData(this.FilePath, this.RustService, this.DialogService); + this.FileContent = fileContent; + this.StateHasChanged(); + } + catch (Exception ex) + { + this.Logger.LogError(ex, "Failed to load file content from '{FilePath}'", this.FilePath); + this.FileContent = string.Empty; + this.StateHasChanged(); + } } + else if (firstRender) + this.Logger.LogWarning("Document check dialog opened without a valid file path"); } private CodeBlockTheme CodeColorPalette => this.SettingsManager.IsDarkMode ? CodeBlockTheme.Dark : CodeBlockTheme.Default;