Prev | Current Page 376 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

Stack.exceptionStack();
trace( haxe.Stack.toString( es ) );
}
}
public static function add( a, b )
{
return a + minus( b, 2 );
}
public static function minus( a, b )
{
return a - multiply( b, 2 );
}
194
Part I: The Core Language
public static function multiply( a, b )
{
throw ???Darn, we have an error???;
return a * b;
}
}
When compiled and run, you should be presented with the following:
ExceptionStack.hx:13: Called from ExceptionStack method multiply
Called from ExceptionStack method minus
Called from ExceptionStack method add
Called from ExceptionStack method main
If you compare this output to that of the callStack() function, you should notice that the journey is a
reverse image, although without the traceStack() method call.
The Exception Master Class
Throughout this chapter, you looked at some very powerful tools to aid in combating errors in your
code, whether they ??™ re structural errors you could have dealt with, or system errors that you as a
developer have no control over.


Pages:
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388