1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-08-30 02:53:11 +02:00

Fix exception messages

This commit is contained in:
2022-02-05 22:31:30 +01:00
parent ad30021d6d
commit c4aa62fc3a
5 changed files with 10 additions and 10 deletions
lib
TweetLib.Browser.CEF
TweetLib.Core
TweetLib.Utils

@@ -66,7 +66,7 @@ namespace TweetLib.Browser.CEF.Logic {
} }
} }
else { else {
throw new InvalidOperationException("This resource filter cannot be reused."); throw new InvalidOperationException("This resource filter cannot be reused!");
} }
} }
} }

@@ -91,20 +91,20 @@ namespace TweetLib.Core {
// Setup // Setup
private static AppBuilder Builder => AppBuilder.Instance ?? throw new InvalidOperationException("App is initializing too early"); private static AppBuilder Builder => AppBuilder.Instance ?? throw new InvalidOperationException("App is initializing too early!");
private static bool isInitialized = false; private static bool isInitialized = false;
internal static void Initialize() { internal static void Initialize() {
if (isInitialized) { if (isInitialized) {
throw new InvalidOperationException("App is already initialized"); throw new InvalidOperationException("App is already initialized!");
} }
isInitialized = true; isInitialized = true;
} }
private static T Validate<T>(T? obj, string name) where T : class { private static T Validate<T>(T? obj, string name) where T : class {
return obj ?? throw new InvalidOperationException("Missing property " + name + " on the provided App"); return obj ?? throw new InvalidOperationException("Missing property " + name + " on the provided App.");
} }
} }

@@ -132,19 +132,19 @@ namespace TweetLib.Core.Features.Plugins {
Plugin plugin = new Plugin(group, identifier, pathRoot, pathData, this); Plugin plugin = new Plugin(group, identifier, pathRoot, pathData, this);
if (plugin.Name.Length == 0) { if (plugin.Name.Length == 0) {
throw new InvalidOperationException("Plugin is missing a name in the .meta file"); throw new InvalidOperationException("Plugin is missing a name in the .meta file.");
} }
if (!PluginEnvironments.All.Any(plugin.HasEnvironment)) { if (!PluginEnvironments.All.Any(plugin.HasEnvironment)) {
throw new InvalidOperationException("Plugin has no script files"); throw new InvalidOperationException("Plugin has no script files.");
} }
if (plugin.Group == PluginGroup.Official) { if (plugin.Group == PluginGroup.Official) {
if (plugin.RequiredVersion != AppVersion) { if (plugin.RequiredVersion != AppVersion) {
throw new InvalidOperationException("Plugin is not supported in this version of TweetDuck, this may indicate a failed update or an unsupported plugin that was not removed automatically"); throw new InvalidOperationException("Plugin is not supported in this version of TweetDuck, this may indicate a failed update or an unsupported plugin that was not removed automatically.");
} }
else if (!string.IsNullOrEmpty(plugin.Version)) { else if (!string.IsNullOrEmpty(plugin.Version)) {
throw new InvalidOperationException("Official plugins cannot have a version identifier"); throw new InvalidOperationException("Official plugins cannot have a version identifier.");
} }
} }

@@ -48,7 +48,7 @@ namespace TweetLib.Core.Features.Plugins {
string metaFile = Path.Combine(pathRoot, ".meta"); string metaFile = Path.Combine(pathRoot, ".meta");
if (!File.Exists(metaFile)) { if (!File.Exists(metaFile)) {
throw new ArgumentException("Plugin is missing a .meta file"); throw new ArgumentException("Plugin is missing a .meta file.");
} }
string? currentTag = null; string? currentTag = null;

@@ -11,7 +11,7 @@ namespace TweetLib.Utils.IO {
private static string ValidateIdentifier(string identifier) { private static string ValidateIdentifier(string identifier) {
if (identifier.IndexOf(KeySeparator) != -1) { if (identifier.IndexOf(KeySeparator) != -1) {
throw new ArgumentException("Identifier must not contain the '|' character"); throw new ArgumentException("Identifier must not contain the '|' character!");
} }
return identifier; return identifier;