bootsharp icon indicating copy to clipboard operation
bootsharp copied to clipboard

Throw meaningful error when JavaScript function is not implemented

Open elringus opened this issue 2 years ago • 0 comments

Currently, when a [JSFunction]-attributed method is invoked while the associated function is not implemented in JavaScript, a JSException is thrown, but without any message to identify reason of the error: https://github.com/Elringus/DotNetJS/blob/f44665a9b7b4259d13469ef5ea928c7cdb6caff1/JavaScript/dotnet-runtime/test/packed.js#L26

We've tried initializing the bindings with function (...args) { throw Error("..."); } instead of undefined: https://github.com/Elringus/DotNetJS/blob/f44665a9b7b4259d13469ef5ea928c7cdb6caff1/DotNet/Packer/LibraryGenerator.cs#L71

— hoping the message will be propagated back to JavaScript, but .NET runtime throws back just the exception name with stacktrace and, more importantly, the runtime fails to invoke the function after such throw, even if it's assigned.

If anyone have any idea on how this can be solved, please let us know here.

elringus avatar Dec 24 '21 19:12 elringus