mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-16 09:21:37 +00:00
Added error handling and logging
This commit is contained in:
parent
d1a0fd23ec
commit
18f3b42106
@ -32,11 +32,22 @@ public partial class DocumentCheckDialog : MSGComponentBase
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender && !string.IsNullOrWhiteSpace(this.FilePath))
|
||||
{
|
||||
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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user