Whenever I create a large Mathematica project I run into this problem: Preventing avalanche of runtime errors in Mathematica, i.e., Mathematica\'s error message are opaque,
To get the ball rolling here is one idea that I've been toying with; the creation of a pseudo stack.
First make a global variable theStack={}
and then in every Function
or Module
start with AppendTo[theStack,"thisFuncName"]
and end with theStack=Most@theStack
. Assuming moderate (~a few tens) depth of function calls, this should not add any significant overhead.
Then implement your own typing/error checking and use Print@theStack;Abort[];
on errors.
Refinements of this method could include:
AppendTo[]
can be made into an identical function call for all Functions
and Module
.Message[]
Instead of Print[]
.theStack
.