Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow JavaScript exceptions to be re-thrown by native bindings #317

Closed
magreenblatt opened this issue Aug 30, 2011 · 4 comments
Closed

Allow JavaScript exceptions to be re-thrown by native bindings #317

magreenblatt opened this issue Aug 30, 2011 · 4 comments
Labels
enhancement Enhancement request

Comments

@magreenblatt
Copy link
Collaborator

Original report by me.


Original issue 317 created by magreenblatt on 2011-08-30T15:43:17.000Z:

Currently, JavaScript exceptions resulting from calling CefV8Value::ExecuteFunction() are returned as a string. It would be nice if these exceptions could be re-thrown for handling by the JavaScript application. For example:

// JS application starts
function jsFoo() { throw "oops"; }
window.registerCallback(jsFoo); // native C++ method

// JS asynchronous operation
try {
window.execCallback(); // native C++ method that executes jsFoo()
} catch (e) {
// got "oops" here
}

@magreenblatt
Copy link
Collaborator Author

Comment 1. originally posted by magreenblatt on 2011-11-10T22:58:01.000Z:

Revision 371 introduces CefV8Exception for returning detailed exception information from CefV8Value::ExecuteFunction*() and adds the ability to re-throw exceptions.

@magreenblatt
Copy link
Collaborator Author

  • set state to "resolved"

@magreenblatt
Copy link
Collaborator Author

Original comment by Dmitry Azaraev (Bitbucket: Mystic Artifact).


Comment 2. originally posted by fddima on 2011-11-10T23:09:00.000Z:

How it works?
Just preserve initial v8 exception with losing of v8->native / native->v8 transitions?

@magreenblatt
Copy link
Collaborator Author

Comment 3. originally posted by magreenblatt on 2011-11-10T23:36:22.000Z:

If the |rethrow_exception| argument to ExecuteFunction*() is true the original exception will be re-thrown. The values available via CefV8Exception are a copy of the values that existed in the original exception. See:
http://code.google.com/p/chromiumembedded/source/browse/trunk/libcef/v8\_impl.cc?spec=svn372&r=371comment 10.86

The new V8Test.Exception test verifies this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement request
Projects
None yet
Development

No branches or pull requests

1 participant