Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

Commented Feature: Throw specific script exception by host [43]

$
0
0
Hi,

Would it be possible to add a custom exception, so that when it is thrown by host it throws a script exception of the specified type and message.

For example, in host code:

```
throw new CustomScriptException("RangeError", "custom message");
```

will cause script to execute:

```
throw new RangeError('custom message');
```

Specifically, for the example above I need the exception to be instanceof RangeError.

Thanks again in advance,
Ron


Comments: Hello! ClearScript uses exception chaining to preserve as much error information as possible. You should be able to use [`InnerException`](http://msdn.microsoft.com/en-us/library/system.exception.innerexception(v=vs.110).aspx) and/or [`GetBaseException()`](http://msdn.microsoft.com/en-us/library/system.exception.innerexception(v=vs.110).aspx) to traverse the exception chain. Good luck!

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images