Feature SS-2314
2 votes

Add an OnError handler

Created by Mike Kaganski on 4/13/2016 3:03 AM Last Updated by Mike Kaganski on 4/16/2016 3:44 AM
%
 (hrs)
Logged: 0   (hrs)

 Description

Currently, if a calculation gives error (e.g., inside a function), it is impossible to intercept it and continue gracefully (a-la "try-catch" block).

Please consider adding a new feature (either as extension, or better as core feature, because it's a kind of basic execution control operator): something like "try-catch" (or better "try-onError"), that would be a function of the kind

try(instr,onError)

where both instr and onError may be arbitrary block including line().

Visually it could resemble if() without condition.

onError block must be evaluated only on error that would otherwise make the instr block "red". Inside the onError block, at least lastError should be already available.

The result of the try() function must be either result of instr, or of onError, dependent on if onError was fired or not. Or alternatively, it may not return a value at all, like for(), to enable using for() as its argument. The best approach would be, if user could get the result of try(), but if its argument if for(), then user would get the same error as if (s)he used result:=for(...).

    Mike Kaganski (Saturday, April 16, 2016 3:44 AM) #

Thank you SO MUCH Andrey!

    smath (Saturday, April 16, 2016 3:41 AM) #

Thank you for request!

try(..) function implemented. See uploaded attachement.