66using OriginalJsEngine = MsieJavaScriptEngine . MsieJsEngine ;
77using OriginalJsEngineLoadException = MsieJavaScriptEngine . JsEngineLoadException ;
88using OriginalJsEngineMode = MsieJavaScriptEngine . JsEngineMode ;
9+ using OriginalJsException = MsieJavaScriptEngine . JsException ;
910using OriginalJsRuntimeException = MsieJavaScriptEngine . JsRuntimeException ;
11+ using OriginalJsScriptInterruptedException = MsieJavaScriptEngine . JsScriptInterruptedException ;
1012using OriginalJsEngineSettings = MsieJavaScriptEngine . JsEngineSettings ;
1113using OriginalTypeConverter = MsieJavaScriptEngine . Utilities . TypeConverter ;
1214using OriginalUndefined = MsieJavaScriptEngine . Undefined ;
@@ -112,18 +114,35 @@ private static object MapToHostType(object value)
112114 return value ;
113115 }
114116
115- private JsRuntimeException ConvertScriptExceptionToHostException (
116- OriginalJsRuntimeException scriptException )
117+ private JsException ConvertScriptExceptionToHostException (
118+ OriginalJsException scriptException )
117119 {
118- var hostException = new JsRuntimeException ( scriptException . Message ,
119- EngineName , _engineVersion , scriptException )
120+ JsException hostException ;
121+
122+ if ( scriptException is OriginalJsRuntimeException )
120123 {
121- ErrorCode = scriptException . ErrorCode ,
122- Category = scriptException . Category ,
123- LineNumber = scriptException . LineNumber ,
124- ColumnNumber = scriptException . ColumnNumber ,
125- SourceFragment = scriptException . SourceFragment
126- } ;
124+ var scriptRuntimeException = ( OriginalJsRuntimeException ) scriptException ;
125+ hostException = new JsRuntimeException ( scriptRuntimeException . Message ,
126+ EngineName , _engineVersion , scriptRuntimeException )
127+ {
128+ ErrorCode = scriptRuntimeException . ErrorCode ,
129+ Category = scriptRuntimeException . Category ,
130+ LineNumber = scriptRuntimeException . LineNumber ,
131+ ColumnNumber = scriptRuntimeException . ColumnNumber ,
132+ SourceFragment = scriptRuntimeException . SourceFragment
133+ } ;
134+ }
135+ else if ( scriptException is OriginalJsScriptInterruptedException )
136+ {
137+ var scriptInterruptedException = ( OriginalJsScriptInterruptedException ) scriptException ;
138+ hostException = new JsScriptInterruptedException ( CoreStrings . Runtime_ScriptInterrupted ,
139+ EngineName , _engineVersion , scriptInterruptedException ) ;
140+ }
141+ else
142+ {
143+ hostException = new JsException ( scriptException . Message ,
144+ EngineName , _engineVersion , scriptException ) ;
145+ }
127146
128147 return hostException ;
129148 }
@@ -145,7 +164,7 @@ protected override object InnerEvaluate(string expression, string documentName)
145164 {
146165 result = _jsEngine . Evaluate ( expression , documentName ) ;
147166 }
148- catch ( OriginalJsRuntimeException e )
167+ catch ( OriginalJsException e )
149168 {
150169 throw ConvertScriptExceptionToHostException ( e ) ;
151170 }
@@ -178,7 +197,7 @@ protected override void InnerExecute(string code, string documentName)
178197 {
179198 _jsEngine . Execute ( code , documentName ) ;
180199 }
181- catch ( OriginalJsRuntimeException e )
200+ catch ( OriginalJsException e )
182201 {
183202 throw ConvertScriptExceptionToHostException ( e ) ;
184203 }
@@ -202,7 +221,7 @@ protected override object InnerCallFunction(string functionName, params object[]
202221 {
203222 result = _jsEngine . CallFunction ( functionName , processedArgs ) ;
204223 }
205- catch ( OriginalJsRuntimeException e )
224+ catch ( OriginalJsException e )
206225 {
207226 throw ConvertScriptExceptionToHostException ( e ) ;
208227 }
@@ -227,7 +246,7 @@ protected override bool InnerHasVariable(string variableName)
227246 {
228247 result = _jsEngine . HasVariable ( variableName ) ;
229248 }
230- catch ( OriginalJsRuntimeException e )
249+ catch ( OriginalJsException e )
231250 {
232251 throw ConvertScriptExceptionToHostException ( e ) ;
233252 }
@@ -243,7 +262,7 @@ protected override object InnerGetVariableValue(string variableName)
243262 {
244263 result = _jsEngine . GetVariableValue ( variableName ) ;
245264 }
246- catch ( OriginalJsRuntimeException e )
265+ catch ( OriginalJsException e )
247266 {
248267 throw ConvertScriptExceptionToHostException ( e ) ;
249268 }
@@ -268,7 +287,7 @@ protected override void InnerSetVariableValue(string variableName, object value)
268287 {
269288 _jsEngine . SetVariableValue ( variableName , processedValue ) ;
270289 }
271- catch ( OriginalJsRuntimeException e )
290+ catch ( OriginalJsException e )
272291 {
273292 throw ConvertScriptExceptionToHostException ( e ) ;
274293 }
@@ -280,7 +299,7 @@ protected override void InnerRemoveVariable(string variableName)
280299 {
281300 _jsEngine . RemoveVariable ( variableName ) ;
282301 }
283- catch ( OriginalJsRuntimeException e )
302+ catch ( OriginalJsException e )
284303 {
285304 throw ConvertScriptExceptionToHostException ( e ) ;
286305 }
@@ -294,7 +313,7 @@ protected override void InnerEmbedHostObject(string itemName, object value)
294313 {
295314 _jsEngine . EmbedHostObject ( itemName , processedValue ) ;
296315 }
297- catch ( OriginalJsRuntimeException e )
316+ catch ( OriginalJsException e )
298317 {
299318 throw ConvertScriptExceptionToHostException ( e ) ;
300319 }
@@ -306,15 +325,15 @@ protected override void InnerEmbedHostType(string itemName, Type type)
306325 {
307326 _jsEngine . EmbedHostType ( itemName , type ) ;
308327 }
309- catch ( OriginalJsRuntimeException e )
328+ catch ( OriginalJsException e )
310329 {
311330 throw ConvertScriptExceptionToHostException ( e ) ;
312331 }
313332 }
314333
315334 protected override void InnerInterrupt ( )
316335 {
317- throw new NotImplementedException ( ) ;
336+ _jsEngine . Interrupt ( ) ;
318337 }
319338
320339 protected override void InnerCollectGarbage ( )
@@ -345,7 +364,7 @@ public override string Version
345364 /// </summary>
346365 public override bool SupportsScriptInterruption
347366 {
348- get { return false ; }
367+ get { return true ; }
349368 }
350369
351370 /// <summary>
0 commit comments