mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-02-15 15:21:37 +00:00
Added error handling and logging
This commit is contained in:
parent
d1a0fd23ec
commit
18f3b42106
@ -33,10 +33,21 @@ public partial class DocumentCheckDialog : MSGComponentBase
|
|||||||
{
|
{
|
||||||
if (firstRender && !string.IsNullOrWhiteSpace(this.FilePath))
|
if (firstRender && !string.IsNullOrWhiteSpace(this.FilePath))
|
||||||
{
|
{
|
||||||
var fileContent = await UserFile.LoadFileData(this.FilePath, this.RustService, this.DialogService);
|
try
|
||||||
this.FileContent = fileContent;
|
{
|
||||||
this.StateHasChanged();
|
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;
|
private CodeBlockTheme CodeColorPalette => this.SettingsManager.IsDarkMode ? CodeBlockTheme.Dark : CodeBlockTheme.Default;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user