mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Handle more exceptions
This commit is contained in:
parent
617c62f6c6
commit
14ffe3c675
1 changed files with 60 additions and 0 deletions
|
|
@ -107,6 +107,16 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
|||
var fileInfo = new FileInfo(filePath);
|
||||
return ResultManager.ToReadableSize(fileInfo.Length, 2);
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"File not found: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to file: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get file size for {filePath}", e);
|
||||
|
|
@ -128,6 +138,16 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
|||
if (showFileAgeInPreviewPanel) result = $"{GetFileAge(createdDate)} - {formattedDate}";
|
||||
return result;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"File not found: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to file: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get file created date for {filePath}", e);
|
||||
|
|
@ -149,6 +169,16 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
|||
if (showFileAgeInPreviewPanel) result = $"{GetFileAge(lastModifiedDate)} - {formattedDate}";
|
||||
return result;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"File not found: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to file: {filePath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get file modified date for {filePath}", e);
|
||||
|
|
@ -171,6 +201,16 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
|||
|
||||
return ResultManager.ToReadableSize(size, 2);
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Folder not found: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to folder: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Operation timed out while calculating folder size for {folderPath}");
|
||||
|
|
@ -197,6 +237,16 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
|||
if (showFileAgeInPreviewPanel) result = $"{GetFileAge(createdDate)} - {formattedDate}";
|
||||
return result;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Folder not found: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to folder: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get folder created date for {folderPath}", e);
|
||||
|
|
@ -218,6 +268,16 @@ public partial class PreviewPanel : UserControl, INotifyPropertyChanged
|
|||
if (showFileAgeInPreviewPanel) result = $"{GetFileAge(lastModifiedDate)} - {formattedDate}";
|
||||
return result;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Folder not found: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
Main.Context.API.LogError(ClassName, $"Access denied to folder: {folderPath}");
|
||||
return Main.Context.API.GetTranslation("plugin_explorer_plugin_tooltip_more_info_unknown");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Main.Context.API.LogException(ClassName, $"Failed to get folder modified date for {folderPath}", e);
|
||||
|
|
|
|||
Loading…
Reference in a new issue