Getting and using class hierarhy information in runtime

Uranuz neuranuz at
Thu Feb 13 19:37:14 PST 2014

In my web application on D I want to implement some type of 
"event based error handling". I'm process some events of request 
handler with some wodified version of this:

I'm trying to implement error handling in event "onError". I pass 
Throwable object as parameter to it. But I want to have these 
events to be sepearted by type so I will attach different 
handlers for different error types at runtime manner as in .NET 
platform. Problem is that I need at first handle "more 
specialized" types of events that inherited from other less 
specialized types.

Is it possible to check somehow at runtime that one object 
inherits from another object somehow using .classinfo property.

I'll try to give an example of what I want. It's may be not 
correct D code.

class BaseHTTPException: Exception

class SpecializedHTTPException: Exception

alias bool function(Throwable error) ErrorHandler;

class RequestHandler

    ErrorHandler[][TypeInfo_Class] _errorHandlers;


void main()

More information about the Digitalmars-d-learn mailing list