Skip to content

Commit acb9f71

Browse files
committed
1. Format of the error messages was unified;
2. Created a new exception classes: `JsCompilationException`, `JsEngineException`, `JsFatalException` and `JsUsageException`. These exceptions are responsible for handling errors, some of which were previously handled by the `JsRuntimeException` class; 3. In the `JsException` class was added two new properties: `Category` and `Description`; 4. From the `JsRuntimeException` class was removed one property - `ErrorCode`; 5. In the `JsRuntimeException` class was added three new properties: `Type`, `DocumentName` and `CallStack`; 6. `JsScriptInterruptedException` class was renamed to the `JsInterruptedException` class and now is inherited from the `JsRuntimeException` class; 7. `JsEngineLoadException` class now is inherited from the `JsEngineException` class; 8. `Format` method of the `JsErrorHelpers` class was renamed to the `GenerateErrorDetails`.
1 parent ac9f76b commit acb9f71

File tree

69 files changed

+4546
-1681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+4546
-1681
lines changed

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2012-2017 Andrey Taritsyn - http://www.taritsyn.ru
1+
Copyright (c) 2012-2018 Andrey Taritsyn - http://www.taritsyn.ru
22

33
Apache License
44
Version 2.0, January 2004

build/common.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<Copyright>Copyright © 2012-2017 Andrey Taritsyn</Copyright>
3+
<Copyright>Copyright © 2012-2018 Andrey Taritsyn</Copyright>
44
</PropertyGroup>
55

66
<PropertyGroup Condition=" '$(TargetFramework)' == 'net40-client' Or '$(TargetFramework)' == 'net45' Or '$(TargetFramework)' == 'net451' ">

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "2.0.3"
3+
"version": "2.1.4"
44
}
55
}

src/MsieJavaScriptEngine/ActiveScript/ActiveScriptException.cs

+42-10
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ public sealed class ActiveScriptException : Exception
1313
/// </summary>
1414
private int _errorCode;
1515

16+
/// <summary>
17+
/// Type of the script error
18+
/// </summary>
19+
private string _type = string.Empty;
20+
1621
/// <summary>
1722
/// Category of error
1823
/// </summary>
@@ -24,9 +29,9 @@ public sealed class ActiveScriptException : Exception
2429
private string _description = string.Empty;
2530

2631
/// <summary>
27-
/// Application specific source context
32+
/// Document name
2833
/// </summary>
29-
private uint _sourceContext;
34+
private string _documentName = string.Empty;
3035

3136
/// <summary>
3237
/// Line number on which the error occurred
@@ -39,7 +44,12 @@ public sealed class ActiveScriptException : Exception
3944
private int _columnNumber;
4045

4146
/// <summary>
42-
/// Content of the line on which the error occurred
47+
/// String representation of the script call stack
48+
/// </summary>
49+
private string _callStack = string.Empty;
50+
51+
/// <summary>
52+
/// Source fragment
4353
/// </summary>
4454
private string _sourceFragment = string.Empty;
4555

@@ -52,6 +62,15 @@ public int ErrorCode
5262
set { _errorCode = value; }
5363
}
5464

65+
/// <summary>
66+
/// Gets or sets a type of the script error
67+
/// </summary>
68+
public string Type
69+
{
70+
get { return _type; }
71+
set { _type = value; }
72+
}
73+
5574
/// <summary>
5675
/// Gets or sets a category of error
5776
/// </summary>
@@ -71,12 +90,12 @@ public string Description
7190
}
7291

7392
/// <summary>
74-
/// Gets or sets a application specific source context
93+
/// Gets or sets a document name
7594
/// </summary>
76-
public uint SourceContext
95+
public string DocumentName
7796
{
78-
get { return _sourceContext; }
79-
set { _sourceContext = value; }
97+
get { return _documentName; }
98+
set { _documentName = value; }
8099
}
81100

82101
/// <summary>
@@ -98,7 +117,16 @@ public int ColumnNumber
98117
}
99118

100119
/// <summary>
101-
/// Gets or sets a content of the line on which the error occurred
120+
/// Gets or sets a string representation of the script call stack
121+
/// </summary>
122+
public string CallStack
123+
{
124+
get { return _callStack; }
125+
set { _callStack = value; }
126+
}
127+
128+
/// <summary>
129+
/// Gets or sets a source fragment
102130
/// </summary>
103131
public string SourceFragment
104132
{
@@ -138,11 +166,13 @@ private ActiveScriptException(SerializationInfo info, StreamingContext context)
138166
if (info != null)
139167
{
140168
_errorCode = info.GetInt32("ErrorCode");
169+
_type = info.GetString("Type");
141170
_category = info.GetString("Category");
142171
_description = info.GetString("Description");
143-
_sourceContext = info.GetUInt32("SourceContext");
172+
_documentName = info.GetString("DocumentName");
144173
_lineNumber = info.GetUInt32("LineNumber");
145174
_columnNumber = info.GetInt32("ColumnNumber");
175+
_callStack = info.GetString("CallStack");
146176
_sourceFragment = info.GetString("SourceFragment");
147177
}
148178
}
@@ -164,11 +194,13 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
164194

165195
base.GetObjectData(info, context);
166196
info.AddValue("ErrorCode", _errorCode);
197+
info.AddValue("Type", _type);
167198
info.AddValue("Category", _category);
168199
info.AddValue("Description", _description);
169-
info.AddValue("SourceContext", _sourceContext);
200+
info.AddValue("DocumentName", _documentName);
170201
info.AddValue("LineNumber", _lineNumber);
171202
info.AddValue("ColumnNumber", _columnNumber);
203+
info.AddValue("CallStack", _callStack);
172204
info.AddValue("SourceFragment", _sourceFragment);
173205
}
174206

0 commit comments

Comments
 (0)