Prev | Current Page 379 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

Granted, this
class is pretty basic, but it does facilitate some of the primary required functionality for your master class.
It is a good practice to name this class Exception , as it is a base class for all future exception objects.
Also, note that the return value for the message getter function has been drastically reduced. This is so
you can provide numerous getters for each information type, so as to provide a more custom style
functionality. Many developers find that, under normal circumstances, a simple message is sufficient
while providing alternative code for intercepted exception objects. However, extensive information is
still required for tasks such as logging and simple bug finding.
class Exception
{
private var __description : String;
private var __infos : haxe.PosInfos;
public var message(getMessage,null) : String;
public function new( msg : String, ?info : haxe.PosInfos )
{
this.__description = msg;
this.__infos = info;
}
public function getMessage() : String
{
return __description;
}
}
As you can see, the message getter now merely returns the message string passed into the constructor of
the class.


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