using System; namespace LibMpc { /// /// Is thrown when a command is to be executed on a disconnected /// where the property is set to false. /// public class NotConnectedException : InvalidOperationException { /// /// Creates a new NotConnectedException. /// public NotConnectedException() : base("Not connected.") {} } /// /// Is thrown when the connect method is invoked on an already connected . /// public class AlreadyConnectedException : InvalidOperationException { /// /// Creates a new AlreadyConnectedException. /// public AlreadyConnectedException() : base("Connected already established.") { } } /// /// Is thrown if the response from a MPD server is not as expected. This should never happen when /// working with a tested version of the MPD server. /// public class InvalidMpdResponseException : Exception { /// /// Creates a new InvalidMpdResponseException. /// public InvalidMpdResponseException() : base( "Invalid Mpd Response." ) {} /// /// Creates a new InvalidMpdResponseException. /// /// A message describing the error. public InvalidMpdResponseException(string message) : base("Invalid Mpd Response: " + message) { } } /// /// Is thrown when the MPD server returns an error to a command. /// public class MpdResponseException : Exception { private int errorCode; private string errorMessage; /// /// The error code of the mpd server. /// public int ErrorCode { get { return this.errorCode; } } /// /// A message describing what went wrong. /// public string ErrorMessage { get { return this.errorMessage; } } /// /// Creates a new MpdResponseException. /// /// The error code of the mpd server. /// A message describing what went wrong. public MpdResponseException(int errorCode, string errorMessage) : base("MPD" + errorCode + " " + errorMessage) { this.errorCode = errorCode; this.errorMessage = errorMessage; } } }