Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects
Commit 210faa03 authored by Michael KRISPER's avatar Michael KRISPER
Browse files

CodeAnalysis: Made VectoExceptions serializable

parent 8b2e58d3
No related branches found
No related tags found
No related merge requests found
......@@ -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) {}
......
......@@ -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) { }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment