forked from Taritsyn/JavaScriptEngineSwitcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJsException.cs
More file actions
57 lines (51 loc) · 1.42 KB
/
JsException.cs
File metadata and controls
57 lines (51 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
namespace JavaScriptEngineSwitcher.ChakraCore.JsRt
{
using System;
/// <summary>
/// The exception returned from the Chakra engine
/// </summary>
internal class JsException : Exception
{
/// <summary>
/// The error code
/// </summary>
private readonly JsErrorCode _code;
/// <summary>
/// Gets a error code
/// </summary>
public JsErrorCode ErrorCode
{
get { return _code; }
}
/// <summary>
/// Initializes a new instance of the <see cref="JsException"/> class
/// </summary>
/// <param name="code">The error code returned</param>
public JsException(JsErrorCode code)
: this(code, "A fatal exception has occurred in a JavaScript runtime")
{ }
/// <summary>
/// Initializes a new instance of the <see cref="JsException"/> class
/// </summary>
/// <param name="code">The error code returned</param>
/// <param name="message">The error message</param>
public JsException(JsErrorCode code, string message)
: base(message)
{
_code = code;
}
/// <summary>
/// Initializes a new instance of the <see cref="JsException"/> class
/// </summary>
/// <param name="message">The error message</param>
/// <param name="innerException">The exception that is the cause of the current exception</param>
protected JsException(string message, Exception innerException)
: base(message, innerException)
{
if (message != null)
{
_code = (JsErrorCode) HResult;
}
}
}
}