-
Notifications
You must be signed in to change notification settings - Fork 79
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
How to use Environment.RaiseError<T>(...) #82
Comments
The raise error was made generic to fulfil F#'s requirements for the function callsites to have a certain return value. Effectively the way it is used is like this:
|
In the wiki article, the methods are static, so there is no inherited RaiseUserError method that is available to call. There are variations on this in the |
I apologise if you simply meant |
One more thing - if you can help me properly understand the correct way to throw errors, even when exposing a CLR method as a JavaScript global function (hence it won't have access to the |
Methods can have access to the global
|
@otac0n: Unless something has been changed recently the first and second parameters should be FunctionObject and CommonObject, not Environment and CommonObject:
|
You can also access the Environment from both self and @this parameters. |
What about the |
In my custom JavaScript object, I'd like to throw JavaScript errors when one or more of the arguments supplied to the constructor or to one of the member functions is invalid.
As best I can tell, I should use environment.
RaiseError<T>(prototype, message)
.What is the correct way to use this method and/or its overloads? I'm catching the UserError exception that is subsequently thrown, but I don't know if I'm doing it correctly because I don't know what the type argument T refers to, or what the correct way to access my error message in the thrown exception is.
The text was updated successfully, but these errors were encountered: