diff --git a/Dalamud/Plugin/Internal/Exceptions/BannedPluginException.cs b/Dalamud/Plugin/Internal/Exceptions/BannedPluginException.cs
index 851e5be33..1119a8c4e 100644
--- a/Dalamud/Plugin/Internal/Exceptions/BannedPluginException.cs
+++ b/Dalamud/Plugin/Internal/Exceptions/BannedPluginException.cs
@@ -3,19 +3,14 @@ namespace Dalamud.Plugin.Internal.Exceptions;
///
/// This represents a banned plugin that attempted an operation.
///
-internal class BannedPluginException : PluginException
+internal class BannedPluginException : PluginPreconditionFailedException
{
///
/// Initializes a new instance of the class.
///
/// The message describing the invalid operation.
public BannedPluginException(string message)
+ : base(message)
{
- this.Message = message;
}
-
- ///
- /// Gets the message describing the invalid operation.
- ///
- public override string Message { get; }
}
diff --git a/Dalamud/Plugin/Internal/Exceptions/PluginPreconditionFailedException.cs b/Dalamud/Plugin/Internal/Exceptions/PluginPreconditionFailedException.cs
new file mode 100644
index 000000000..c1bb58d0d
--- /dev/null
+++ b/Dalamud/Plugin/Internal/Exceptions/PluginPreconditionFailedException.cs
@@ -0,0 +1,16 @@
+namespace Dalamud.Plugin.Internal.Exceptions;
+
+///
+/// An exception to be thrown when policy blocks a plugin from loading.
+///
+internal class PluginPreconditionFailedException : InvalidPluginOperationException
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message to associate with this exception.
+ public PluginPreconditionFailedException(string message)
+ : base(message)
+ {
+ }
+}
diff --git a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs
index 91f1625a7..aff9a8b43 100644
--- a/Dalamud/Plugin/Internal/Types/LocalPlugin.cs
+++ b/Dalamud/Plugin/Internal/Types/LocalPlugin.cs
@@ -315,23 +315,23 @@ internal class LocalPlugin : IDisposable
}
if (pluginManager.IsManifestBanned(this.manifest) && !this.IsDev)
- throw new BannedPluginException($"Unable to load {this.Name}, banned");
+ throw new BannedPluginException($"Unable to load {this.Name} as it was banned");
if (this.manifest.ApplicableVersion < dalamud.StartInfo.GameVersion)
- throw new InvalidPluginOperationException($"Unable to load {this.Name}, no applicable version");
+ throw new PluginPreconditionFailedException($"Unable to load {this.Name}, game is newer than applicable version {this.manifest.ApplicableVersion}");
if (this.manifest.DalamudApiLevel < PluginManager.DalamudApiLevel && !pluginManager.LoadAllApiLevels)
- throw new InvalidPluginOperationException($"Unable to load {this.Name}, incompatible API level");
+ throw new PluginPreconditionFailedException($"Unable to load {this.Name}, incompatible API level {this.manifest.DalamudApiLevel}");
// We might want to throw here?
if (!this.IsWantedByAnyProfile)
Log.Warning("{Name} is loading, but isn't wanted by any profile", this.Name);
if (this.IsOrphaned)
- throw new InvalidPluginOperationException($"Plugin {this.Name} had no associated repo.");
+ throw new PluginPreconditionFailedException($"Plugin {this.Name} had no associated repo");
if (!this.CheckPolicy())
- throw new InvalidPluginOperationException("Plugin was not loaded as per policy");
+ throw new PluginPreconditionFailedException($"Unable to load {this.Name} as a load policy forbids it");
this.State = PluginState.Loading;
Log.Information($"Loading {this.DllFile.Name}");
@@ -439,7 +439,10 @@ internal class LocalPlugin : IDisposable
{
this.State = PluginState.LoadError;
- if (ex is not BannedPluginException)
+ // If a precondition fails, don't record it as an error, as it isn't really.
+ if (ex is PluginPreconditionFailedException)
+ Log.Warning(ex.Message);
+ else
Log.Error(ex, $"Error while loading {this.Name}");
throw;