chore: remove error messagebox in Dalamud.Injector, the program that runs it should show an error instead

This commit is contained in:
goaaats 2022-06-23 23:49:44 +02:00
parent 62d34f326a
commit bf72ad589d
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B

View file

@ -143,7 +143,6 @@ namespace Dalamud.Injector
Console.WriteLine("Command line error: {0}", clex.Message); Console.WriteLine("Command line error: {0}", clex.Message);
Console.WriteLine(); Console.WriteLine();
ProcessHelpCommand(args); ProcessHelpCommand(args);
Environment.Exit(-1);
} }
else if (Log.Logger == null) else if (Log.Logger == null)
{ {
@ -151,27 +150,13 @@ namespace Dalamud.Injector
} }
else if (exObj is Exception ex) else if (exObj is Exception ex)
{ {
Log.Error(ex, "A fatal error has occurred."); Log.Error(ex, "A fatal error has occurred");
} }
else else
{ {
Log.Error($"A fatal error has occurred: {eventArgs.ExceptionObject}"); Log.Error("A fatal error has occurred: {Exception}", eventArgs.ExceptionObject.ToString());
} }
#if DEBUG
var caption = "Debug Error";
var message =
$"Couldn't inject.\nMake sure that Dalamud was not injected into your target process " +
$"as a release build before and that the target process can be accessed with VM_WRITE permissions.\n\n" +
$"{eventArgs.ExceptionObject}";
#else
var caption = "XIVLauncher Error";
var message =
"Failed to inject the XIVLauncher in-game addon.\nPlease try restarting your game and your PC.\n" +
"If this keeps happening, please report this error.";
#endif
_ = MessageBoxW(IntPtr.Zero, message, caption, MessageBoxType.IconError | MessageBoxType.Ok);
Environment.Exit(-1); Environment.Exit(-1);
}; };
} }