diff --git a/VectoCommon/VectoCommon/Exceptions/VectoExceptions.cs b/VectoCommon/VectoCommon/Exceptions/VectoExceptions.cs index 46f62d57b21cd2ca8851e6823de1906458b1854b..d5551f7a00dcc7a93c7c373f04b27eec3f40dbc2 100644 --- a/VectoCommon/VectoCommon/Exceptions/VectoExceptions.cs +++ b/VectoCommon/VectoCommon/Exceptions/VectoExceptions.cs @@ -31,6 +31,7 @@ using System; using System.IO; +using System.Runtime.Serialization; using TUGraz.VectoCommon.Models; namespace TUGraz.VectoCommon.Exceptions @@ -38,8 +39,11 @@ namespace TUGraz.VectoCommon.Exceptions /// <summary> /// Base Exception for all Exception in VECTO. /// </summary> + [Serializable] public class VectoException : Exception { + protected VectoException(SerializationInfo info, StreamingContext context) : base(info, context) {} + public VectoException(string message) : base(message) { LogManager.Flush(); @@ -66,6 +70,7 @@ namespace TUGraz.VectoCommon.Exceptions /// <summary> /// Exception when an Input/Output related error occured. /// </summary> + [Serializable] public abstract class FileIOException : VectoException { protected FileIOException(string message) : base(message) {} @@ -75,6 +80,7 @@ namespace TUGraz.VectoCommon.Exceptions /// <summary> /// Exception when the file format is invalid or a file was not found. /// </summary> + [Serializable] public class InvalidFileFormatException : FileIOException { public InvalidFileFormatException(string message) : base(message) {} @@ -85,6 +91,7 @@ namespace TUGraz.VectoCommon.Exceptions /// <summary> /// Exception which gets thrown when the version of a file is not supported. /// </summary> + [Serializable] public class UnsupportedFileVersionException : FileIOException { public UnsupportedFileVersionException(string message) : base(message) {} @@ -98,6 +105,7 @@ namespace TUGraz.VectoCommon.Exceptions /// <summary> /// Exception which gets thrown when an error occurred during read of a vecto csv-file. /// </summary> + [Serializable] public class CSVReadException : FileIOException { public CSVReadException(string message) : base(message) {} diff --git a/VectoCommon/VectoCommon/Exceptions/VectoSimulationException.cs b/VectoCommon/VectoCommon/Exceptions/VectoSimulationException.cs index 4ad924d871fe2b310a9875f51dee79b841d114b2..502b8e1b8c22b349c5534b3794b3b59566ee201a 100644 --- a/VectoCommon/VectoCommon/Exceptions/VectoSimulationException.cs +++ b/VectoCommon/VectoCommon/Exceptions/VectoSimulationException.cs @@ -30,10 +30,12 @@ */ using System; +using System.Runtime.Serialization; using TUGraz.VectoCommon.Models; namespace TUGraz.VectoCommon.Exceptions { + [Serializable] public class VectoSimulationException : VectoException { public VectoSimulationException(string msg) : base(msg) {} @@ -44,8 +46,11 @@ namespace TUGraz.VectoCommon.Exceptions //[StringFormatMethod("message")] public VectoSimulationException(string message, Exception inner, params object[] args) : base(message, inner, args) {} + + protected VectoSimulationException(SerializationInfo info, StreamingContext context) : base(info, context) { } } + [Serializable] public class VectoEngineSpeedTooLowException : VectoSimulationException { public VectoEngineSpeedTooLowException(string msg) : base(msg) {} @@ -56,8 +61,20 @@ namespace TUGraz.VectoCommon.Exceptions : base(message, inner, args) {} } + [Serializable] public class UnexpectedResponseException : VectoSimulationException { + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("Response", Response); + } + + protected UnexpectedResponseException(SerializationInfo info, StreamingContext context) : base(info, context) + { + Response = (IResponse)info.GetValue("Response", typeof(IResponse)); + } + public IResponse Response; public UnexpectedResponseException(string message, IResponse resp) @@ -67,11 +84,13 @@ namespace TUGraz.VectoCommon.Exceptions } } + [Serializable] public class VectoSearchFailedException : VectoException { public VectoSearchFailedException(string message, params object[] args) : base(message, args) {} } + [Serializable] public class VectoSearchAbortedException : VectoException { public VectoSearchAbortedException(string message, params object[] args) : base(message, args) { }