Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

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

CodeAnalysis: Made VectoExceptions serializable

parent 8b2e58d3
Branches
Tags
No related merge requests found
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
using System; using System;
using System.IO; using System.IO;
using System.Runtime.Serialization;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
namespace TUGraz.VectoCommon.Exceptions namespace TUGraz.VectoCommon.Exceptions
...@@ -38,8 +39,11 @@ namespace TUGraz.VectoCommon.Exceptions ...@@ -38,8 +39,11 @@ namespace TUGraz.VectoCommon.Exceptions
/// <summary> /// <summary>
/// Base Exception for all Exception in VECTO. /// Base Exception for all Exception in VECTO.
/// </summary> /// </summary>
[Serializable]
public class VectoException : Exception public class VectoException : Exception
{ {
protected VectoException(SerializationInfo info, StreamingContext context) : base(info, context) {}
public VectoException(string message) : base(message) public VectoException(string message) : base(message)
{ {
LogManager.Flush(); LogManager.Flush();
...@@ -66,6 +70,7 @@ namespace TUGraz.VectoCommon.Exceptions ...@@ -66,6 +70,7 @@ namespace TUGraz.VectoCommon.Exceptions
/// <summary> /// <summary>
/// Exception when an Input/Output related error occured. /// Exception when an Input/Output related error occured.
/// </summary> /// </summary>
[Serializable]
public abstract class FileIOException : VectoException public abstract class FileIOException : VectoException
{ {
protected FileIOException(string message) : base(message) {} protected FileIOException(string message) : base(message) {}
...@@ -75,6 +80,7 @@ namespace TUGraz.VectoCommon.Exceptions ...@@ -75,6 +80,7 @@ namespace TUGraz.VectoCommon.Exceptions
/// <summary> /// <summary>
/// Exception when the file format is invalid or a file was not found. /// Exception when the file format is invalid or a file was not found.
/// </summary> /// </summary>
[Serializable]
public class InvalidFileFormatException : FileIOException public class InvalidFileFormatException : FileIOException
{ {
public InvalidFileFormatException(string message) : base(message) {} public InvalidFileFormatException(string message) : base(message) {}
...@@ -85,6 +91,7 @@ namespace TUGraz.VectoCommon.Exceptions ...@@ -85,6 +91,7 @@ namespace TUGraz.VectoCommon.Exceptions
/// <summary> /// <summary>
/// Exception which gets thrown when the version of a file is not supported. /// Exception which gets thrown when the version of a file is not supported.
/// </summary> /// </summary>
[Serializable]
public class UnsupportedFileVersionException : FileIOException public class UnsupportedFileVersionException : FileIOException
{ {
public UnsupportedFileVersionException(string message) : base(message) {} public UnsupportedFileVersionException(string message) : base(message) {}
...@@ -98,6 +105,7 @@ namespace TUGraz.VectoCommon.Exceptions ...@@ -98,6 +105,7 @@ namespace TUGraz.VectoCommon.Exceptions
/// <summary> /// <summary>
/// Exception which gets thrown when an error occurred during read of a vecto csv-file. /// Exception which gets thrown when an error occurred during read of a vecto csv-file.
/// </summary> /// </summary>
[Serializable]
public class CSVReadException : FileIOException public class CSVReadException : FileIOException
{ {
public CSVReadException(string message) : base(message) {} public CSVReadException(string message) : base(message) {}
......
...@@ -30,10 +30,12 @@ ...@@ -30,10 +30,12 @@
*/ */
using System; using System;
using System.Runtime.Serialization;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
namespace TUGraz.VectoCommon.Exceptions namespace TUGraz.VectoCommon.Exceptions
{ {
[Serializable]
public class VectoSimulationException : VectoException public class VectoSimulationException : VectoException
{ {
public VectoSimulationException(string msg) : base(msg) {} public VectoSimulationException(string msg) : base(msg) {}
...@@ -44,8 +46,11 @@ namespace TUGraz.VectoCommon.Exceptions ...@@ -44,8 +46,11 @@ namespace TUGraz.VectoCommon.Exceptions
//[StringFormatMethod("message")] //[StringFormatMethod("message")]
public VectoSimulationException(string message, Exception inner, params object[] args) : base(message, inner, args) {} 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 class VectoEngineSpeedTooLowException : VectoSimulationException
{ {
public VectoEngineSpeedTooLowException(string msg) : base(msg) {} public VectoEngineSpeedTooLowException(string msg) : base(msg) {}
...@@ -56,8 +61,20 @@ namespace TUGraz.VectoCommon.Exceptions ...@@ -56,8 +61,20 @@ namespace TUGraz.VectoCommon.Exceptions
: base(message, inner, args) {} : base(message, inner, args) {}
} }
[Serializable]
public class UnexpectedResponseException : VectoSimulationException 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 IResponse Response;
public UnexpectedResponseException(string message, IResponse resp) public UnexpectedResponseException(string message, IResponse resp)
...@@ -67,11 +84,13 @@ namespace TUGraz.VectoCommon.Exceptions ...@@ -67,11 +84,13 @@ namespace TUGraz.VectoCommon.Exceptions
} }
} }
[Serializable]
public class VectoSearchFailedException : VectoException public class VectoSearchFailedException : VectoException
{ {
public VectoSearchFailedException(string message, params object[] args) : base(message, args) {} public VectoSearchFailedException(string message, params object[] args) : base(message, args) {}
} }
[Serializable]
public class VectoSearchAbortedException : VectoException public class VectoSearchAbortedException : VectoException
{ {
public VectoSearchAbortedException(string message, params object[] args) : base(message, args) { } 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.
Please register or to comment