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

New Post: Exception propagation from C# to Javascript

0
0
Hi,

I have a number of C# host objects added into the engine.
In case of exception within C#, the exception caught in the javascript has message as "Exception has been thrown by the target of an invocation" and type as object. Here is the sample code:
_try
{
loginResponse = httpclient.Post(authUri,JSON.stringify(loginInfo), '', '', 'application/json');
}
catch(err)
{
Log.Error('err message...' + err.message);
var type = typeof err;
Log.Info('Exception returned type - ' + type);  
}_
httpclient and Log are my host objects here.

I tried adding the expected exception type as hosttype but still its the same.

Is there any better way to handle this ?
I need to know the actual type or message. Looks like the whole exception object is getting lost due to a re-throw like scenario?

Viewing all articles
Browse latest Browse all 2297

Latest Images

Trending Articles





Latest Images