view mde/mergetag/exception.d @ 11:b940f267419e

Options class created & changes to mergetag exception messages. Options class created (barebones). Loading/saving from Init. Init no longer runs cleanup functions after initialisation failure. Improved mergetag exception messages & error reporting. committer: Diggory Hardy <diggory.hardy@gmail.com>
author Diggory Hardy <diggory.hardy@gmail.com>
date Thu, 21 Feb 2008 09:05:33 +0000
parents 4c3575400769
children bff0d802cb7d
line wrap: on
line source

/*******************************************
 * Contains exception classes for MergeTag.
 *
 * Publically imports mde.exception.
 ******************************************/
module mde.mergetag.exception;

public import mde.exception;

/// Base MergeTag exception class.
class MTException : mdeException {
    static const char[] symbol;
    static this() {	symbol = super.symbol ~ ".mergetag";	}
    char[] getSymbol () {
        return symbol;
    }
    
    this (char[] msg) {
        super(msg);
    }
    this () {   // Only called when an unexpected exception/error occurs
        super ("Unknown exception");
    }
}

/** Thrown on file IO errors. */
class MTFileIOException : MTException {
    this () {
        super ("File IO exception");
    }
}

/** Thrown on unknown format errors; when reading or writing and the filetype cannot be guessed. */
class MTFileFormatException : MTException {
    this () {
        super ("File format exception");
    }
}

/** Thrown on syntax errors when reading; bad tags or unexpected EOF. */
class MTSyntaxException : MTException {
    this () {
        super ("Syntax exception");
    }
}

/** Thrown by addTag (in classes implementing dataset.DataSection) when a tag is read with an
 * unrecognised type field. */
class MTUnknownTypeException : MTException {
    this () {
        super ("Unknown type");
    }
    this (char[] msg) {
        super (msg);
    }
}

/** Thrown by addTag (in classes implementing dataset.DataSection) when a data parsing error occurs
* (really just to make whoever called addTag to log a warning saying where the error occured). */
class MTaddTagParseException : MTException {
    this () {
        super ("Parse exception within addTag");
    }
}

/+
/// Thrown by TypeView.parse on errors.
class MTBadTypeStringException : MTException {
    this () {}
}
+/

/// Thrown by *Writer.write.
class MTNoDataSetException : MTException {
    this () {
        super ("No dataset");
    }
}