/*
* Copyright 2008 Matthias Sessler
*
* This file is part of LibMpc.net.
*
* LibMpc.net is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 2.1 of the License, or
* (at your option) any later version.
*
* LibMpc.net is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LibMpc.net. If not, see .
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
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;
}
}
}