using System; using System.Runtime.Serialization; namespace Chernobyl.Creation { /// /// An exception that is thrown when an instance of a type or some other /// item could not be constructed. /// public class CreationException : Exception { /// /// Initializes a new instance of the . /// /// The error message that explains the reason for /// the exception. public CreationException(string message) : this(message, (Type)null) { } /// /// Initializes a new instance of the /// class. /// /// The error message that explains the reason for /// the exception. /// The that could /// not be constructed/configured or null if the /// construction/configuration failure refers to another kind of item. public CreationException(string message, Type failedCreatedType) : this(message, null, failedCreatedType) { } /// /// Initializes a new instance of the class. /// /// The error message that explains the reason for /// the exception. /// The exception that is the cause of the /// current exception, or a null reference (Nothing in Visual Basic) if /// no inner exception is specified. public CreationException(string message, Exception innerException) : this(message, innerException, null) { } /// /// Initializes a new instance of the class. /// /// The error message that explains the reason for /// the exception. /// The exception that is the cause of the /// current exception, or a null reference (Nothing in Visual Basic) if /// no inner exception is specified. /// The that could /// not be constructed/configured or null if the /// construction/configuration failure refers to another kind of item. public CreationException(string message, Exception innerException, Type failedCreatedType) : base(message, innerException) { FailedCreatedType = failedCreatedType; } /// /// Initializes a new instance of the class. /// /// The that holds /// the serialized object data about the exception being thrown. /// The that contains /// contextual information about the source or destination. /// The /// parameter is null. /// The class name is null or /// is zero (0). public CreationException(SerializationInfo info, StreamingContext context) : base(info, context) { } /// /// The that could not be constructed/configured or /// null if the construction/configuration failure refers to another /// kind of item. /// public Type FailedCreatedType { get; set; } } }