1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-01 17:34:10 +02:00

Fix exception messages

This commit is contained in:
chylex 2022-02-05 22:31:30 +01:00
parent ad30021d6d
commit c4aa62fc3a
Signed by: chylex
GPG Key ID: 4DE42C8F19A80548
5 changed files with 10 additions and 10 deletions
lib
TweetLib.Browser.CEF/Logic
TweetLib.Core
TweetLib.Utils/IO

View File

@ -66,7 +66,7 @@ public FilterStatus Filter(Stream? dataIn, out long dataInRead, Stream dataOut,
} }
} }
else { else {
throw new InvalidOperationException("This resource filter cannot be reused."); throw new InvalidOperationException("This resource filter cannot be reused!");
} }
} }
} }

View File

@ -91,20 +91,20 @@ public static void Close() {
// 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.");
} }
} }

View File

@ -132,19 +132,19 @@ public Plugin BuildAndSetup() {
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.");
} }
} }

View File

@ -48,7 +48,7 @@ public static Plugin FromFolder(string name, string pathRoot, string pathData, P
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;

View File

@ -11,7 +11,7 @@ public sealed class CombinedFileStream : IDisposable {
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;