Open otac0n opened 13 years ago
Would love to see exceptions thrown by the runtime updated so they have helpful messages. This would make it a lot easier to figure out why they have been thrown without needing a deep understanding of IronJS' internals.
Using the wiki article Create a custom javascript object, I created my first custom object for use my with my JavaScript context. Construction of the object worked fine, but when I called the method LoadURL on my object, the following exception was thrown:
Exception thrown: IronJS.UserError: TypeError: 8 at IronJS.Hosting.FSharp.run(Delegate compiled, T t) in C:\Users\otac0n\Projects\IronJS\Src\IronJS\Hosting.fs:line 151 at IronJS.Hosting.CSharp.Context.Execute(String source) in C:\Users\otac0n\Projects\IronJS\Src\IronJS\Hosting.fs:line 240 at ...
Debugging eventually revealed that it was my fault - I messed up the casing when calling my custom object's only function, but this took me a while to realise due to the obscure error message.
Agreed! "TypeError: N" is really useless for debugging.
Take this for example:
This should throw an error indicating that the String prototype does not contain a method called "substr", but rather throws an error with the message "TypeError: N", which is entirely unhelpful.