-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPanic.cs
More file actions
37 lines (33 loc) · 811 Bytes
/
Panic.cs
File metadata and controls
37 lines (33 loc) · 811 Bytes
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
using System;
/// <summary>
/// A class that manages errors
/// </summary>
class panic {
public static Exception exception;
/// <summary>
/// Raises an exception
/// </summary>
public static void raise(Exception ex) {
exception = ex;
}
/// <summary>
/// Raises an exception
/// </summary>
public static void raise(string message) {
raise(new Exception(message));
}
/// <summary>
/// Raises an exception
/// </summary>
public static void raise(string message, Exception ex) {
raise(new Exception(message, ex));
}
/// <summary>
/// Kills the current thread if there is an exception
/// </summary>
public static void check() {
if (exception != null) {
throw exception;
}
}
}