using System;
namespace FlickrNet
{
///
/// A FlickrException, thrown when a connection to Flickr fails.
///
[Serializable]
public class FlickrException : Exception
{
private int code;
private string msg = "";
///
/// Get the code of the Flickr error.
///
public int Code
{
get { return code; }
}
///
/// Gets the verbose message returned by Flickr.
///
public string Verbose
{
get { return msg; }
}
///
/// Creates a new exception with the given the code and verbose message string
///
/// The code of the error. 100 is Invalid Api Key and 99 is User not logged in. Others are method specific.
/// The verbose description of the error.
public FlickrException(int code, string verbose)
{
this.code = code;
msg = verbose;
}
///
/// Creates a new exception from the class.
///
/// An instance of the class.
public FlickrException(ResponseError error)
{
code = error.Code;
msg = error.Message;
}
///
/// Overrides the message to return custom error message.
///
public override string Message
{
get
{
return msg + " (" + code + ")";
}
}
}
}