-
Notifications
You must be signed in to change notification settings - Fork 4
Fix/check initialised #43
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
Conversation
| if (typeof thingToWrap != "function") { | ||
| if (typeof thingToWrap !== "function") { | ||
| if (!thingToWrap[__isinitialised__]) { | ||
| throw new Error(`cannot call "${name}" outside "draw", "setup" or event handlers`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eah13 you might want to think about the wording of this error. And we might want to throw a real python exception here. But which one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw a real python exception
I can't think of an appropriate one. I don't think you'd encounter an analogous situation in Python.
We could invent a new exception ala SuspensionError, perhaps ProcessingError?
brianpmarks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! There are conflicts on the built files though so maybe previous PRs need to be pulled into this branch?
|
Yeah I'll merge and rebuild. |
14ba1fb to
4762866
Compare
throws an error message if a function is called before processing is initialised.
See: http://albertjan-dev.trinket.io/python/9f0110db88