Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
quit(), exit() or stop()?
billy2
Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
Let's say I'm checking a bunch of imported data and I decide to just give up.
<div> println('there\'s no data to read\nplease readData first'); <span style="font-family: Flama, sans-serif;"> quit();</span></div>
0
Comments
?
?
break; leaves a loop, I'm not in a loop.
In php it's called exit; it kills everything.
I'm using return(true) & return(false) to guard entire blocks of code from executing which works but its really ugly.
So I'm converting readData.csv into a vector array using a function and if things aren't correct I want to post a note and quit. Using return(false) means I have to handle this every time I call this function which is really ugly.
Another way to handle this is to give me an onload() function, remember this is like javascript. Do you have this? A way to execute a function onload? Onload() converts readData.csv into vectors. Sweet, then my vector array is ready for all subsequent feature function calls.
throw regenError('Sorry, that input is too confusing');
Script running:
Script error and I capture event:
Throw error:
I like this because the feature goes red indicating an error. Not sure I like all to links to broken code. Maybe there should be a silent mode that doesn't include these links.
throw error('works');
Thanks John,