According to the Spark2014 documentation, one is not allowed to handle exceptions in Spark code.
With verification, most run-time errors can be excluded to occur inside a written program, but exceptions like Storage_Error can not be excluded.
Since the Storage_Error could occur on every procedure/function call or when dynamically allocating memory using new (please correct me if I am wrong on that), catching and handling this exception in a code segment with Spark_Mode=off would only be valid at the highest level of a program (the entry point of a program). I really don't like this approach, since you lose nearly all possibilities to react on such an exception.
What I would like to do:
Assume to create an unbounded tree with a procedure Add(). Inside this procedure I would like to check, if there is enough space on the heap, to create a new node inside the tree.
If there is, allocate memory for the node and add it to the tree, otherwise an out parameter could be given, where somekind of flag is set.
I have searched through the Spark UserGuide, but was not able to find a way how this should be handled, only that the programmer has to make sure, that there is enough memory available, but not how one could do that.
How could one handle those kind of exceptions in Spark?