Last change
on this file since 2106 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
|
Rev | Line | |
---|
[1625] | 1 | using System.Collections.Generic;
|
---|
| 2 | using System;
|
---|
| 3 | using HeuristicLab.Persistence.Interfaces;
|
---|
| 4 | using HeuristicLab.Persistence.Core.Tokens;
|
---|
[1823] | 5 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
[2106] | 6 | using System.Text;
|
---|
[1625] | 7 |
|
---|
| 8 | namespace HeuristicLab.Persistence.Core {
|
---|
| 9 |
|
---|
[1659] | 10 | [Serializable]
|
---|
[1625] | 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) { }
|
---|
[2106] | 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 | }
|
---|
[1625] | 32 | }
|
---|
| 33 |
|
---|
| 34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.