This repository was archived by the owner on Apr 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathEcmaScriptError.cs
More file actions
99 lines (88 loc) · 3.23 KB
/
Copy pathEcmaScriptError.cs
File metadata and controls
99 lines (88 loc) · 3.23 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//------------------------------------------------------------------------------
// <license file="EcmaScriptError.cs">
//
// The use and distribution terms for this software are contained in the file
// named 'LICENSE', which can be found in the resources directory of this
// distribution.
//
// By using this software in any fashion, you are agreeing to be bound by the
// terms of this license.
//
// </license>
//------------------------------------------------------------------------------
using System;
namespace EcmaScript.NET
{
/// <summary> The class of exceptions raised by the engine as described in
/// ECMA edition 3. See section 15.11.6 in particular.
/// </summary>
public class EcmaScriptError : EcmaScriptException
{
/// <summary> Gets the name of the error.
///
/// ECMA edition 3 defines the following
/// errors: EvalError, RangeError, ReferenceError,
/// SyntaxError, TypeError, and URIError. Additional error names
/// may be added in the future.
///
/// See ECMA edition 3, 15.11.7.9.
///
/// </summary>
/// <returns> the name of the error.
/// </returns>
public virtual string Name
{
get
{
return m_ErrorName;
}
}
public override string Message
{
get
{
return string.Format (
"\"{0}\", {1} at line {2}: {3}",
base.SourceName, Name, base.LineNumber, ErrorMessage);
}
}
/// <summary> Gets the message corresponding to the error.
///
/// See ECMA edition 3, 15.11.7.10.
///
/// </summary>
/// <returns> an implemenation-defined string describing the error.
/// </returns>
public virtual string ErrorMessage
{
get
{
return m_ErrorMessage;
}
}
string m_ErrorName;
string m_ErrorMessage;
/// <summary> Create an exception with the specified detail message.
///
/// Errors internal to the JavaScript engine will simply throw a
/// RuntimeException.
///
/// </summary>
/// <param name="sourceName">the name of the source reponsible for the error
/// </param>
/// <param name="lineNumber">the line number of the source
/// </param>
/// <param name="columnNumber">the columnNumber of the source (may be zero if
/// unknown)
/// </param>
/// <param name="lineSource">the source of the line containing the error (may be
/// null if unknown)
/// </param>
internal EcmaScriptError (string errorName, string errorMessage, string sourceName, int lineNumber, string lineSource, int columnNumber)
{
RecordErrorOrigin (sourceName, lineNumber, lineSource, columnNumber);
this.m_ErrorName = errorName;
this.m_ErrorMessage = errorMessage;
}
}
}