Sfoglia il codice sorgente

Add a custom missing dependency exception

Bepis 7 anni fa
parent
commit
09eaca0144
1 ha cambiato i file con 14 aggiunte e 1 eliminazioni
  1. 14 1
      BepInEx/TypeLoader.cs

+ 14 - 1
BepInEx/TypeLoader.cs

@@ -72,7 +72,7 @@ namespace BepInEx
                 Type dependencyType = AllPlugins.FirstOrDefault(x => GetMetadata(x)?.GUID == dependency.refGUID);
 
                 if (dependencyType == null)
-                    throw new Exception("Cannot find dependency type.");
+                    throw new MissingDependencyException("Cannot find dependency type.");
 
                 dependencyTypes.Add(dependencyType);
             }
@@ -80,4 +80,17 @@ namespace BepInEx
             return dependencyTypes;
         }
     }
+
+    public class MissingDependencyException : Exception
+    {
+        public MissingDependencyException() : base()
+        {
+
+        }
+
+        public MissingDependencyException(string message) : base(message)
+        {
+
+        }
+    }
 }