Dynamic facilitates a catchall block, which means that any exception thrown by the code
nested inside the try block will end here. If you still want to catch specific exception types first, then
you can place these before the Dynamic catch statement so that they are dealt with before the exceptions
ever reach the Dynamic catch.
Handling Complex Exceptions
Handling primitive exceptions is not a very useful feature, unless you simply wish to output a little
text when an exception is thrown, but being able to filter what exceptions are caught is very useful
indeed when applied to objects. For example, it could be that you develop a set of classes or typedefs
oriented to containing information specific to errors. This way, not only can you throw more information
on a particular error, but you could also group error types using a class hierarchy and handle them in a
logical order.
Here ??™ s a look at this in an example. First, you ??™ ll need a generic error object. This object will need to
transport any type of error possible, so should provide a simple but extendable feature set:
class GenericError
{
public var message( getDescription,null ) : String;
private var __description : String;
private var __info : haxe.
Pages:
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379