Ver código fonte

Remove try-catch nesting

David 4 anos atrás
pai
commit
677bba742e
1 arquivos alterados com 7 adições e 10 exclusões
  1. 7 10
      Emby.Server.Implementations/Plugins/PluginManager.cs

+ 7 - 10
Emby.Server.Implementations/Plugins/PluginManager.cs

@@ -112,16 +112,7 @@ namespace Emby.Server.Implementations.Plugins
                     {
                         assembly = Assembly.LoadFrom(file);
 
-                        try
-                        {
-                            assembly.GetExportedTypes();
-                        }
-                        catch (TypeLoadException ex) // Undocumented exception
-                        {
-                            _logger.LogError(ex, "Failed to load assembly {Path}. This error occurs when a plugin references an incompatible version of one of the shared libraries. Disabling plugin.", file);
-                            ChangePluginState(plugin, PluginStatus.NotSupported);
-                            continue;
-                        }
+                        assembly.GetExportedTypes();
                     }
                     catch (FileLoadException ex)
                     {
@@ -129,6 +120,12 @@ namespace Emby.Server.Implementations.Plugins
                         ChangePluginState(plugin, PluginStatus.Malfunctioned);
                         continue;
                     }
+                    catch (TypeLoadException ex) // Undocumented exception
+                    {
+                        _logger.LogError(ex, "Failed to load assembly {Path}. This error occurs when a plugin references an incompatible version of one of the shared libraries. Disabling plugin.", file);
+                        ChangePluginState(plugin, PluginStatus.NotSupported);
+                        continue;
+                    }
 
                     _logger.LogInformation("Loaded assembly {Assembly} from {Path}", assembly.FullName, file);
                     yield return assembly;