Skip to content

Conversation

@albertjan
Copy link
Contributor

@albertjan albertjan commented Sep 10, 2018

throws an error message if a function is called before processing is initialised.

See: http://albertjan-dev.trinket.io/python/9f0110db88

if (typeof thingToWrap != "function") {
if (typeof thingToWrap !== "function") {
if (!thingToWrap[__isinitialised__]) {
throw new Error(`cannot call "${name}" outside "draw", "setup" or event handlers`);
Copy link
Contributor Author

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?

Copy link
Member

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?

Copy link
Member

@brianpmarks brianpmarks left a 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?

@albertjan
Copy link
Contributor Author

Yeah I'll merge and rebuild.

@albertjan albertjan force-pushed the fix/check-initialised branch from 14ba1fb to 4762866 Compare September 11, 2018 19:00
@albertjan albertjan merged commit df7c84a into master Sep 11, 2018
@albertjan albertjan deleted the fix/check-initialised branch September 11, 2018 19:01
@eah13 eah13 mentioned this pull request Nov 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants