@@ -26,11 +26,6 @@ public sealed class MsieJsEngine : IDisposable
2626 /// </summary>
2727 const string MSIE_JAVASCRIPT_LIBRARY_RESOURCE_NAME = "MsieJavaScriptEngine.Resources.msieJavaScriptEngine.min.js" ;
2828
29- /// <summary>
30- /// The error code is encountered in accessing to the undefined value
31- /// </summary>
32- const int VALUE_UNDEFINED_ERROR_CODE = - 2146823279 ;
33-
3429 /// <summary>
3530 /// Regular expression for working with JS-names
3631 /// </summary>
@@ -247,26 +242,11 @@ public T Evaluate<T>(string expression)
247242
248243 private object EvaluateInner ( string expression )
249244 {
250- object result ;
251- try
252- {
253- result = _activeScriptSite . ExecuteScriptText ( expression , true ) ;
254- }
255- catch ( ActiveScriptException e )
256- {
257- if ( e . ErrorCode == VALUE_UNDEFINED_ERROR_CODE )
258- {
259- result = null ;
260- }
261- else
262- {
263- throw ;
264- }
265- }
245+ object result = _activeScriptSite . ExecuteScriptText ( expression , true ) ;
266246
267247 if ( result == null )
268248 {
269- throw new NullReferenceException (
249+ throw new UndefinedValueException (
270250 string . Format ( Strings . Runtime_ExpressionResultIsUndefined , expression ) ) ;
271251 }
272252
@@ -515,7 +495,7 @@ public bool HasProperty(string variableName, string propertyName)
515495
516496 if ( ! HasVariableInner ( variableName ) )
517497 {
518- throw new NullReferenceException (
498+ throw new UndefinedValueException (
519499 string . Format ( Strings . Runtime_VariableNotExist , variableName ) ) ;
520500 }
521501
@@ -550,7 +530,7 @@ public object GetPropertyValue(string variableName, string propertyName)
550530
551531 if ( ! HasVariableInner ( variableName ) )
552532 {
553- throw new NullReferenceException (
533+ throw new UndefinedValueException (
554534 string . Format ( Strings . Runtime_VariableNotExist , variableName ) ) ;
555535 }
556536
@@ -583,7 +563,7 @@ public T GetPropertyValue<T>(string variableName, string propertyName)
583563
584564 if ( ! HasVariableInner ( variableName ) )
585565 {
586- throw new NullReferenceException (
566+ throw new UndefinedValueException (
587567 string . Format ( Strings . Runtime_VariableNotExist , variableName ) ) ;
588568 }
589569
0 commit comments