using System; using System.Runtime.Serialization; namespace SFML { //////////////////////////////////////////////////////////// /// /// Exception thrown by SFML whenever loading a resource fails /// //////////////////////////////////////////////////////////// [Serializable] public class LoadingFailedException : Exception { //////////////////////////////////////////////////////////// /// /// Default constructor (unknown error) /// //////////////////////////////////////////////////////////// public LoadingFailedException() : base("Failed to load a resource") { } //////////////////////////////////////////////////////////// /// /// Failure to load a resource from memory /// /// Name of the resource //////////////////////////////////////////////////////////// public LoadingFailedException(string resourceName) : base("Failed to load " + resourceName + " from memory") { } //////////////////////////////////////////////////////////// /// /// Failure to load a resource from memory /// /// Name of the resource /// Exception which is the cause ofthe current exception //////////////////////////////////////////////////////////// public LoadingFailedException(string resourceName, Exception innerException) : base("Failed to load " + resourceName + " from memory", innerException) { } //////////////////////////////////////////////////////////// /// /// Failure to load a resource from a file /// /// Name of the resource /// Path of the file //////////////////////////////////////////////////////////// public LoadingFailedException(string resourceName, string filename) : base("Failed to load " + resourceName + " from file " + filename) { } //////////////////////////////////////////////////////////// /// /// Failure to load a resource from a file /// /// Name of the resource /// Path of the file /// Exception which is the cause ofthe current exception //////////////////////////////////////////////////////////// public LoadingFailedException(string resourceName, string filename, Exception innerException) : base("Failed to load " + resourceName + " from file " + filename, innerException) { } //////////////////////////////////////////////////////////// /// /// Initialize an instance of the exception with serialized data /// /// Serialized data /// Contextual informations //////////////////////////////////////////////////////////// public LoadingFailedException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }