forked from Taritsyn/JavaScriptEngineSwitcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJsScriptException.cs
More file actions
74 lines (67 loc) · 2.09 KB
/
JsScriptException.cs
File metadata and controls
74 lines (67 loc) · 2.09 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#if !NETSTANDARD1_3
using System;
using System.Runtime.Serialization;
#endif
namespace JavaScriptEngineSwitcher.ChakraCore.JsRt
{
/// <summary>
/// The script exception
/// </summary>
#if !NETSTANDARD1_3
[Serializable]
#endif
public sealed class JsScriptException : JsException
{
/// <summary>
/// The error metadata
/// </summary>
#if !NETSTANDARD1_3
[NonSerialized]
#endif
private readonly JsValue _metadata;
/// <summary>
/// Gets a JavaScript object representing the error metadata
/// </summary>
internal JsValue Metadata
{
get { return _metadata; }
}
/// <summary>
/// Initializes a new instance of the <see cref="JsScriptException"/> class
/// </summary>
/// <param name="errorCode">The error code returned</param>
public JsScriptException(JsErrorCode errorCode)
: this(errorCode, "JavaScript Exception")
{ }
/// <summary>
/// Initializes a new instance of the <see cref="JsScriptException"/> class
/// </summary>
/// <param name="errorCode">The error code returned</param>
/// <param name="message">The error message</param>
public JsScriptException(JsErrorCode errorCode, string message)
: this(errorCode, JsValue.Invalid, message)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="JsScriptException"/> class
/// with a specified error message
/// </summary>
/// <param name="errorCode">The error code returned</param>
/// <param name="metadata">The JavaScript error metadata</param>
/// <param name="message">The error message</param>
internal JsScriptException(JsErrorCode errorCode, JsValue metadata, string message)
: base(errorCode, message)
{
_metadata = metadata;
}
#if !NETSTANDARD1_3
/// <summary>
/// Initializes a new instance of the <see cref="JsScriptException"/> class with serialized data
/// </summary>
/// <param name="info">The object that holds the serialized data</param>
/// <param name="context">The contextual information about the source or destination</param>
private JsScriptException(SerializationInfo info, StreamingContext context)
: base(info, context)
{ }
#endif
}
}