Explorar el Código

Add a custom missing dependency exception

Bepis hace 7 años
padre
commit
09eaca0144
Se han modificado 1 ficheros con 14 adiciones y 1 borrados
  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)
+        {
+
+        }
+    }
 }