Throwing Exceptions in Javascript Functions

Issue #73 resolved
Scott MacLellan
created an issue

I was hoping to add some simple exception handling to my application using something like the following (a function updated in the test application):

void TestFunction_Execute(object sender, Chromium.Remote.Event.CfrV8HandlerExecuteEventArgs e) {
    form.LogWriteLine("TestFunction_Execute({0}, {1})", sender, e);
    e.Exception = "test";
}

However this crashes the browser process killing the renderer. I also tried switching "test" to "'test'" and "throw 'test'" with no success. There is little to no information from debugging in VS aside from the connecting with the renderer is lost.

Any help or suggestions would be greatly appreciated.

Comments (6)

  1. wborgsm

    I think this is fixed now in version 3.2526.5. That was a really stupid bug releasing the pinned pointer of a GcHandle instead of the pointer to the handle itself. This could have never worked, so I guess you are the first one to try to use the exception parameter :)

    With "debugging in VS", I guess you mean debugging the render process because the browser process is just debugging the program from the VS IDE. To debug the render process, you can launch a debugger early by uncommenting line 43 in RemoteClient.cs.

    Thanks for pointing this out. Can you confirm your code works now?

  2. Scott MacLellan reporter

    Thanks for the rapid fix! I will try to take a look at it tomorrow because today I have a demo of what I built with ChromiumFX.

    You are right, I was only debugging the render process. I will try launching the debugger in my browser process when I verify the fix.

  3. wborgsm

    If you find it fixed, you shouldn't need to debug the render process. Also I think I misread your comment, when you said "little to no information from debugging" I read "little to no information for debugging" and thought you were looking for debugging instructions in the project documentation, that's why I commented about it :)

  4. Log in to comment