Last change
on this file since 2580 was
2106,
checked in by epitzer, 15 years ago
|
Collect all exceptions during serialization and continue as far as possible. Throw a collected exception in th end. (#678)
|
File size:
1.1 KB
|
Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using System;
|
---|
3 | using HeuristicLab.Persistence.Interfaces;
|
---|
4 | using HeuristicLab.Persistence.Core.Tokens;
|
---|
5 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
6 | using System.Text;
|
---|
7 |
|
---|
8 | namespace HeuristicLab.Persistence.Core {
|
---|
9 |
|
---|
10 | [Serializable]
|
---|
11 | public class PersistenceException : Exception {
|
---|
12 | public PersistenceException() : base() { }
|
---|
13 | public PersistenceException(string message) : base(message) { }
|
---|
14 | public PersistenceException(string message, Exception innerException) : base(message, innerException) { }
|
---|
15 | public PersistenceException(string message, IEnumerable<Exception> innerExceptions)
|
---|
16 | : base(message) {
|
---|
17 | int i = 0;
|
---|
18 | foreach (var x in innerExceptions) {
|
---|
19 | i += 1;
|
---|
20 | this.Data.Add("Inner Exception " + i, x);
|
---|
21 | }
|
---|
22 | }
|
---|
23 | public override string ToString() {
|
---|
24 | var sb = new StringBuilder()
|
---|
25 | .Append(base.ToString())
|
---|
26 | .Append('\n');
|
---|
27 | foreach (Exception x in Data.Values) {
|
---|
28 | sb.Append(x.ToString()).Append('\n');
|
---|
29 | }
|
---|
30 | return sb.ToString();
|
---|
31 | }
|
---|
32 | }
|
---|
33 |
|
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.