view mde/exception.d @ 4:9a990644948c

Many changes: upgraded to tango 0.99.4, reorganised mde/input, large changes to mde/mergetag and mde/init, separated off test/MTTest.d and more. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Sun, 06 Jan 2008 17:38:51 +0000
parents d547009c104c
children b544c3a7c9ca
line wrap: on
line source

/// Contains a base class for all mde exceptions.
module mde.exception;

/** Base class for all mde Exceptions.
 *
 * All packages should have their own base exception type extending this one, and for each package
 * level a CTOR taking a message should pass the message to the super prepended with "package: ".
 * The performance of this is unimportant since exceptions are only intended for recovering from
 * unexpected errors anyway. A CTOR not taking a message and calling the super without a parameter
 * should also be provided.
 */
class mdeException : Exception {
    const symbol = "mde";	/// Override in derived classes.
    this (char[] msg) {
        super(symbol ~ ": " ~ msg);
    }
    this () {
        super("");	// Exception doesn't have a this() CTOR
    }
}

class initException : mdeException {
    const override symbol = super.symbol ~ ".init";
    this (char[] msg) {
        super(msg);
    }
}

class DynamicLibraryLoadException : initException {
    this (char[] msg) {
        super("when loading dynamic library: " ~ msg);
    }
}