try-catch bolock please!

Request a new command, feature, or improvement

Moderator: MSandro

Post Reply
User avatar
Picochilla
Posts: 28
Joined: Sep 23rd, '17, 17:44

try-catch bolock please!

Post by Picochilla » Nov 11th, '17, 14:53

Hi, in the last days, I came into some situations where I realy need something like better error-handling in GP.
I am working on an realy modular project, it is very interactive, so the user have to insert data to performing several things, but I can't handle all mistakes and errors with "if-statements". I try to rewrite a C# programm in GP only for fun an chalanging. There are so many situations where a try-catch block would be very helpful.
try-catch.png
try-catch.png (2.47 KiB) Viewed 3899 times
Thank you very much for this nice scatch-like programming language, I realy love it to push those graphical languages to there limits.
Also the maximum of RAM wich GP is allowed to use is realy to small.

MSandro
Posts: 162
Joined: Jul 26th, '17, 21:12

Re: try-catch bolock please!

Post by MSandro » Nov 22nd, '17, 21:08

Hi, I also requested something like this with no feedback.
But maybe you can realize some of your error-handling with many if statements and the return block to exit a procedure.

I know this is not a great solution, but I think GP is currently focused to be the milldle between Scretch and programming languages like Python to make the switch from scratch to regulary languages a bit easier. And not as a language wich you can use for an easier coding of your windows applications. Maybe in the future, when the focus is more on advanced use of GP.

I am not very happy about this fact. But maybe I'm wrong too.

JohnM
Posts: 379
Joined: Sep 11th, '15, 14:42

Re: try-catch bolock please!

Post by JohnM » Nov 26th, '17, 18:21

About 99% of the time, I prefer using if statements and returns to handle expected errors, as MSandro suggested.

However, there are are a few cases when one needs a mechanism that can catch and recover from unexpected errors. For example, making a robust server that recovers from unexpected errors, is one such case.

I'll think about how add such a mechanism to GP in developer mode. It might not be a block in the palette, since I don't want people to think that's the recommended way to deal with errors, but I imagine even a block you needed to get from the Developer Mode System Palette would be helpful for the 1% of the time you really need it.

Post Reply