mercredi 18 janvier 2017

induce error for debugging purposes?

Hypothetically, I have a switch that has 437 cases. I've identified every possible case (I think), and each is handled. I'm worried that I missed # 438, and want something in the Default to alert me of this.
I could put a

trace("ERROR! Stackoverflow has detected your ginormous gaffe and suspended your account indefinitely!");

in there, but I'm worried that this error will occur 7 weeks from now and the trace will be lost among all of my other silly warning traces. I've considered having my Default do this:

trace(myArray[-1]);

which would surely(?) give an error and stop the program, alerting me to my hideous oversight, but am wondering if there isn't some better, smarter way to go about detecting a possible error like this.
Anyone? Bueller?

Aucun commentaire:

Enregistrer un commentaire