Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Persistence/3.3/Core/PersistenceException.cs @ 3577

Last change on this file since 3577 was 3016, checked in by epitzer, 14 years ago

Update API docs. (#548)

File size: 2.4 KB
Line 
1using System.Collections.Generic;
2using System;
3using HeuristicLab.Persistence.Interfaces;
4using HeuristicLab.Persistence.Core.Tokens;
5using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
6using System.Text;
7
8namespace HeuristicLab.Persistence.Core {
9
10  /// <summary>
11  /// Exception thrown by components inside the persistence framework.
12  /// </summary>
13  [Serializable] 
14  public class PersistenceException : Exception {
15
16    /// <summary>
17    /// Initializes a new instance of the <see cref="PersistenceException"/> class.
18    /// </summary>
19    public PersistenceException() : base() { }
20
21    /// <summary>
22    /// Initializes a new instance of the <see cref="PersistenceException"/> class.
23    /// </summary>
24    /// <param name="message">The message.</param>
25    public PersistenceException(string message) : base(message) { }
26
27    /// <summary>
28    /// Initializes a new instance of the <see cref="PersistenceException"/> class.
29    /// </summary>
30    /// <param name="message">The message.</param>
31    /// <param name="innerException">The inner exception.</param>
32    public PersistenceException(string message, Exception innerException) :
33      base(message, innerException) { }
34
35    /// <summary>
36    /// Initializes a new instance of the <see cref="PersistenceException"/> class.
37    /// </summary>
38    /// <param name="message">The message.</param>
39    /// <param name="innerExceptions">The inner exceptions.</param>
40    public PersistenceException(string message, IEnumerable<Exception> innerExceptions)
41      : base(message) {
42      int i = 0;
43      foreach (var x in innerExceptions) {
44        i += 1;
45        this.Data.Add("Inner Exception " + i, x);
46      }
47    }
48
49    /// <summary>
50    /// Returns a <see cref="System.String"/> that represents this instance.
51    /// </summary>
52    /// <returns>
53    /// A <see cref="System.String"/> that represents this instance.
54    /// </returns>
55    /// <PermissionSet>
56    ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PathDiscovery="*AllFiles*"/>
57    /// </PermissionSet>
58    public override string ToString() {
59      var sb = new StringBuilder()
60        .Append(base.ToString())
61        .Append('\n');
62      foreach (Exception x in Data.Values) {
63        sb.Append(x.ToString()).Append('\n');
64      }
65      return sb.ToString();
66    }
67  }
68 
69}
Note: See TracBrowser for help on using the repository browser.