[3743] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[12009] | 3 | * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[3743] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 |
|
---|
[4068] | 22 | using System;
|
---|
[3743] | 23 | using System.Collections.Generic;
|
---|
[4722] | 24 | using System.Runtime.Serialization;
|
---|
[2106] | 25 | using System.Text;
|
---|
[1625] | 26 |
|
---|
| 27 | namespace HeuristicLab.Persistence.Core {
|
---|
| 28 |
|
---|
[3016] | 29 | /// <summary>
|
---|
| 30 | /// Exception thrown by components inside the persistence framework.
|
---|
| 31 | /// </summary>
|
---|
[4068] | 32 | [Serializable]
|
---|
[1625] | 33 | public class PersistenceException : Exception {
|
---|
[3016] | 34 |
|
---|
| 35 | /// <summary>
|
---|
| 36 | /// Initializes a new instance of the <see cref="PersistenceException"/> class.
|
---|
| 37 | /// </summary>
|
---|
[1625] | 38 | public PersistenceException() : base() { }
|
---|
[3016] | 39 |
|
---|
| 40 | /// <summary>
|
---|
| 41 | /// Initializes a new instance of the <see cref="PersistenceException"/> class.
|
---|
| 42 | /// </summary>
|
---|
| 43 | /// <param name="message">The message.</param>
|
---|
[1625] | 44 | public PersistenceException(string message) : base(message) { }
|
---|
[3016] | 45 |
|
---|
| 46 | /// <summary>
|
---|
| 47 | /// Initializes a new instance of the <see cref="PersistenceException"/> class.
|
---|
| 48 | /// </summary>
|
---|
| 49 | /// <param name="message">The message.</param>
|
---|
| 50 | /// <param name="innerException">The inner exception.</param>
|
---|
| 51 | public PersistenceException(string message, Exception innerException) :
|
---|
| 52 | base(message, innerException) { }
|
---|
| 53 |
|
---|
| 54 | /// <summary>
|
---|
| 55 | /// Initializes a new instance of the <see cref="PersistenceException"/> class.
|
---|
| 56 | /// </summary>
|
---|
| 57 | /// <param name="message">The message.</param>
|
---|
| 58 | /// <param name="innerExceptions">The inner exceptions.</param>
|
---|
[2106] | 59 | public PersistenceException(string message, IEnumerable<Exception> innerExceptions)
|
---|
| 60 | : base(message) {
|
---|
| 61 | int i = 0;
|
---|
| 62 | foreach (var x in innerExceptions) {
|
---|
| 63 | i += 1;
|
---|
| 64 | this.Data.Add("Inner Exception " + i, x);
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
[3016] | 67 |
|
---|
[4413] | 68 | protected PersistenceException(SerializationInfo info, StreamingContext context) : base(info, context) { }
|
---|
| 69 |
|
---|
[3016] | 70 | /// <summary>
|
---|
| 71 | /// Returns a <see cref="System.String"/> that represents this instance.
|
---|
| 72 | /// </summary>
|
---|
| 73 | /// <returns>
|
---|
| 74 | /// A <see cref="System.String"/> that represents this instance.
|
---|
| 75 | /// </returns>
|
---|
| 76 | /// <PermissionSet>
|
---|
| 77 | /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PathDiscovery="*AllFiles*"/>
|
---|
| 78 | /// </PermissionSet>
|
---|
[2106] | 79 | public override string ToString() {
|
---|
| 80 | var sb = new StringBuilder()
|
---|
| 81 | .Append(base.ToString())
|
---|
| 82 | .Append('\n');
|
---|
| 83 | foreach (Exception x in Data.Values) {
|
---|
| 84 | sb.Append(x.ToString()).Append('\n');
|
---|
| 85 | }
|
---|
| 86 | return sb.ToString();
|
---|
| 87 | }
|
---|
[1625] | 88 | }
|
---|
[4068] | 89 |
|
---|
[1625] | 90 | } |
---|