Skip to content

Commit 7b1a9de

Browse files
committed
clarify more error messages
1 parent 396415d commit 7b1a9de

3 files changed

Lines changed: 15 additions & 13 deletions

File tree

FlashpointSecurePlayer/EnvironmentVariables.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ private string GetValue(EnvironmentVariablesElement environmentVariablesElement)
208208
// because the compatibility layers only take effect
209209
// on process start
210210
if (values.Except(compatibilityLayerValues, StringComparer.OrdinalIgnoreCase).Any()) {
211-
throw new CompatibilityLayersException("The Compatibility Layers \"" + value + "\" require a restart to be set.");
211+
throw new CompatibilityLayersException("The Compatibility Layers \"" + value + "\" require the application to restart to be set.");
212212
}
213213
}
214214
}

FlashpointSecurePlayer/FlashpointSecurePlayerGUI.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,10 @@ private void RestartApplication(bool runAsAdministrator, ref Mutex applicationMu
243243
LogExceptionToLauncher(ex);
244244
Show();
245245
ShowErrorFatal(Properties.Resources.ProcessUnableToStart);
246-
throw new ApplicationRestartRequiredException("The application failed to restart.");
246+
throw new InvalidModificationException("The Modification failed because the application failed to restart.");
247247
}
248248

249-
throw new InvalidModificationException("The Modification is restarting the application.");
249+
throw new InvalidModificationException("The Modification requires the application to restart.");
250250
}
251251

252252
private void AskLaunch(string applicationRestartMessage, string descriptionMessage = null) {
@@ -261,7 +261,7 @@ private void AskLaunch(string applicationRestartMessage, string descriptionMessa
261261

262262
if (dialogResult == DialogResult.No) {
263263
Application.Exit();
264-
throw new InvalidModificationException("The operation was aborted by the user.");
264+
throw new InvalidModificationException("The Modification asked to launch and the operation was aborted by the user.");
265265
}
266266
}
267267

@@ -293,7 +293,7 @@ the program to enter an infinite restart loop
293293

294294
// we're already running as admin or failed to restart
295295
ShowError(String.Format(Properties.Resources.GameUnableToLaunch, Properties.Resources.AsAdministratorUser));
296-
throw new InvalidModificationException("The Modification failed to run as Administrator User.");
296+
throw new InvalidModificationException("The Modification failed to launch as Administrator User.");
297297
}
298298

299299
private void AskLaunchWithCompatibilitySettings() {
@@ -311,7 +311,7 @@ private void AskLaunchWithCompatibilitySettings() {
311311
}
312312

313313
ShowError(String.Format(Properties.Resources.GameUnableToLaunch, Properties.Resources.WithCompatibilitySettings));
314-
throw new InvalidModificationException("The Modification failed to run with Compatibility Settings.");
314+
throw new InvalidModificationException("The Modification failed to launch with Compatibility Settings.");
315315
}
316316

317317
private void AskLaunchWithOldCPUSimulator() {
@@ -382,7 +382,7 @@ private void AskLaunchWithOldCPUSimulator() {
382382
}
383383

384384
ShowError(String.Format(Properties.Resources.GameUnableToLaunch, Properties.Resources.WithOldCPUSimulator));
385-
throw new InvalidModificationException("The Modification failed to run with Old CPU Simulator.");
385+
throw new InvalidModificationException("The Modification failed to launch with Old CPU Simulator.");
386386
}
387387

388388
private async Task<StringBuilder> GetHTDOCSFilePath(string url) {
@@ -826,7 +826,7 @@ private async Task ActivateModificationsAsync(TemplateElement templateElement, E
826826
if (!createdNew) {
827827
if (!modificationsMutex.WaitOne()) {
828828
errorDelegate(Properties.Resources.AnotherInstancePreventingTemplate);
829-
throw new InvalidModificationException("Another Modification is activating.");
829+
throw new InvalidModificationException("The Modification failed to activate because another Modification is activating.");
830830
}
831831
}
832832

@@ -852,7 +852,8 @@ private async Task ActivateModificationsAsync(TemplateElement templateElement, E
852852

853853
if (activeTemplateElement != null) {
854854
if (!String.IsNullOrEmpty(activeTemplateElement.Active)) {
855-
throw new InvalidModificationException("The Template Element \"" + activeTemplateElement.Active + "\" is active.");
855+
errorDelegate(Properties.Resources.AnotherInstancePreventingTemplate);
856+
throw new InvalidModificationException("The Modification failed to activate because the Template Element \"" + activeTemplateElement.Active + "\" is active.");
856857
}
857858
}
858859

@@ -896,6 +897,7 @@ private async Task ActivateModificationsAsync(TemplateElement templateElement, E
896897
} catch (ConfigurationErrorsException ex) {
897898
LogExceptionToLauncher(ex);
898899
errorDelegate(Properties.Resources.ConfigurationUnableToLoad);
900+
throw new InvalidModificationException("The Modification failed to activate because the configuration failed to load.");
899901
}
900902

901903
if (ModificationsRevertMethod == MODIFICATIONS_REVERT_METHOD.CRASH_RECOVERY) {
@@ -1080,7 +1082,7 @@ private void DeactivateModifications(ErrorDelegate errorDelegate) {
10801082
if (!createdNew) {
10811083
if (!modificationsMutex.WaitOne()) {
10821084
errorDelegate(Properties.Resources.AnotherInstancePreventingTemplate);
1083-
throw new InvalidModificationException("Another Modification is activating.");
1085+
throw new InvalidModificationException("The Modification failed to deactivate because another Modification is activating.");
10841086
}
10851087
}
10861088

@@ -1178,7 +1180,7 @@ await ActivateModificationsAsync(templateElement, delegate (string text) {
11781180
Application.Exit();
11791181
}
11801182

1181-
throw new InvalidModificationException("An error occured while activating the Modification.");
1183+
throw new InvalidModificationException("The Modification failed to activate.");
11821184
}).ConfigureAwait(true);
11831185
} catch (InvalidModificationException ex) {
11841186
// delegate handles error
@@ -1349,7 +1351,7 @@ private void FlashpointSecurePlayer_Load(object sender, EventArgs e) {
13491351
try {
13501352
DeactivateModifications(delegate (string text) {
13511353
ShowErrorFatal(text);
1352-
throw new InvalidModificationException("An error occured while deactivating the Modification.");
1354+
throw new InvalidModificationException("The Modification failed to deactivate.");
13531355
});
13541356
} catch (InvalidModificationException ex) {
13551357
// delegate handles error

FlashpointSecurePlayer/OldCPUSimulator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public void Activate(string templateName, ref ProcessStartInfo softwareProcessSt
138138
case ModeElement.NAME.WEB_BROWSER:
139139
// server mode, need to restart the whole app
140140
// handled in the GUI side of things
141-
throw new OldCPUSimulatorRequiresApplicationRestartException("The Old CPU Simulator in Web Browser Mode requires a restart.");
141+
throw new OldCPUSimulatorRequiresApplicationRestartException("The Old CPU Simulator in Web Browser Mode requires the application to restart.");
142142
case ModeElement.NAME.SOFTWARE:
143143
// USB the HDMI to .exe the database
144144
string commandLineExpanded = Environment.ExpandEnvironmentVariables(modeElement.CommandLine);

0 commit comments

Comments
 (0)