#region License Information
/* HeuristicLab
* Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;
namespace HeuristicLab.Persistence.Core {
///
/// Exception thrown by components inside the persistence framework.
///
[Serializable]
public class PersistenceException : Exception {
///
/// Initializes a new instance of the class.
///
public PersistenceException() : base() { }
///
/// Initializes a new instance of the class.
///
/// The message.
public PersistenceException(string message) : base(message) { }
///
/// Initializes a new instance of the class.
///
/// The message.
/// The inner exception.
public PersistenceException(string message, Exception innerException) :
base(message, innerException) { }
///
/// Initializes a new instance of the class.
///
/// The message.
/// The inner exceptions.
public PersistenceException(string message, IEnumerable innerExceptions)
: base(message) {
int i = 0;
foreach (var x in innerExceptions) {
i += 1;
this.Data.Add("Inner Exception " + i, x);
}
}
protected PersistenceException(SerializationInfo info, StreamingContext context) : base(info, context) { }
///
/// Returns a that represents this instance.
///
///
/// A that represents this instance.
///
///
///
///
public override string ToString() {
var sb = new StringBuilder()
.Append(base.ToString())
.Append('\n');
foreach (Exception x in Data.Values) {
sb.Append(x.ToString()).Append('\n');
}
return sb.ToString();
}
}
}