mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 06:23:24 -07:00
Added error handling to Initialize method in Win10Plugin
This pull request adds more robust error handling to the Initialize method in the Win10Plugin class. The changes include: 1. Added a try-catch block to the Initialize method to catch and log any exceptions that occur during initialization. 2. Enhanced the logging of exceptions to include not only the error message but also the entire error content, including the stack trace. This change makes debugging easier by providing more context when an error occurs.
This commit is contained in:
parent
a3e65fee6f
commit
92528efaf5
1 changed files with 24 additions and 15 deletions
|
@ -61,6 +61,8 @@ namespace Greenshot.Plugin.Win10
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
|
/// <returns>true if plugin is initialized, false if not (doesn't show)</returns>
|
||||||
public bool Initialize()
|
public bool Initialize()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// Here we check if the build version of Windows is actually what we support
|
// Here we check if the build version of Windows is actually what we support
|
||||||
if (!WindowsVersion.IsWindows10BuildOrLater(17763))
|
if (!WindowsVersion.IsWindows10BuildOrLater(17763))
|
||||||
|
@ -78,8 +80,15 @@ namespace Greenshot.Plugin.Win10
|
||||||
// Add the destinations
|
// Add the destinations
|
||||||
SimpleServiceProvider.Current.AddService<IDestination>(new Win10OcrDestination());
|
SimpleServiceProvider.Current.AddService<IDestination>(new Win10OcrDestination());
|
||||||
SimpleServiceProvider.Current.AddService<IDestination>(new Win10ShareDestination());
|
SimpleServiceProvider.Current.AddService<IDestination>(new Win10ShareDestination());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Log.Error("Failed to initialize Win10Plugin. Error: " + e.ToString(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Shutdown()
|
public void Shutdown()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue