bootsharp
bootsharp copied to clipboard
Throw meaningful error when JavaScript function is not implemented
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.