forked from KSP-ModularManagement/ModuleManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFatalErrorHandler.cs
More file actions
38 lines (37 loc) · 1.42 KB
/
Copy pathFatalErrorHandler.cs
File metadata and controls
38 lines (37 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using UnityEngine;
namespace ModuleManager
{
public static class FatalErrorHandler
{
public static void HandleFatalError(string message)
{
Logging.ModLogger.LOG.error(message);
try
{
PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new MultiOptionDialog(
"ModuleManagerFatalError",
$"ModuleManager has encountered a fatal error and KSP needs to close.\n\n{message}\n\nPlease see KSP's log for addtional details",
"ModuleManager - Fatal Error",
HighLogic.UISkin,
new Rect(0.5f, 0.5f, 500f, 60f),
new DialogGUIFlexibleSpace(),
new DialogGUIHorizontalLayout(
new DialogGUIFlexibleSpace(),
new DialogGUIButton("Quit", Application.Quit, 140.0f, 30.0f, true),
new DialogGUIFlexibleSpace()
)
),
true,
HighLogic.UISkin);
}
catch(Exception ex)
{
Logging.ModLogger.LOG.error(ex, "Exception while trying to create the fatal exception dialog");
Application.Quit();
}
}
}
}