#region CPL License
/*
Nuclex Framework
Copyright (C) 2002-2009 Nuclex Development Labs
This library is free software; you can redistribute it and/or
modify it under the terms of the IBM Common Public License as
published by the IBM Corporation; either version 1.0 of the
License, or (at your option) any later version.
This library 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
IBM Common Public License for more details.
You should have received a copy of the IBM Common Public
License along with this library
*/
#endregion
using System;
using System.Collections.Generic;
namespace Nuclex.Audio.Metadata.Exceptions {
/// Base class for exceptions indicating CDDB errors
///
/// Please do not use this class directly, it is only intended to serve as a base
/// class for specialized exceptions matching the CDDB error status codes.
///
[Serializable]
public class CddbException : Exception {
/// Initializes the exception
/// CDDB status code to provide with the exception
protected CddbException(int statusCode) {
this.statusCode = statusCode;
}
/// Initializes the exception with an error message
/// CDDB status code to provide with the exception
/// Error message describing the cause of the exception
protected CddbException(int statusCode, string message) :
base(message) {
this.statusCode = statusCode;
}
/// Initializes the exception as a followup exception
/// CDDB status code to provide with the exception
/// Error message describing the cause of the exception
/// Preceding exception that has caused this exception
protected CddbException(int statusCode, string message, Exception inner) :
base(message, inner) {
this.statusCode = statusCode;
}
/// Initializes the exception from its serialized state
/// Contains the serialized fields of the exception
/// Additional environmental informations
protected CddbException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context
) :
base(info, context) {
this.statusCode = info.GetInt32("statusCode");
}
///
/// Provides the System.Runtime.Serialization.SerializationInfo instance
/// with information about the exception
///
///
/// The System.Runtime.Serialization.SerializationInfo instance that holds
/// the serialized object data about the exception being thrown
///
///
/// The System.Runtime.Serialization.StreamingContext instance that contains
/// contextual information about the source or destination.
///
public override void GetObjectData(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context
) {
base.GetObjectData(info, context);
info.AddValue("statusCode", this.statusCode);
}
///
/// CDDB status code that indicates the problem reported by the exception
///
public int StatusCode {
get { return this.statusCode; }
}
/// CDDB status code for the problem reported by the exception
private int statusCode;
}
} // namespace Nuclex.Audio.Metadata.Exceptions