Skip to content

Commit 9bfa992

Browse files
committed
Mark exceptions as serializable
1 parent 5c0684f commit 9bfa992

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

src/React/Exceptions/JsxException.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
*/
99

1010
using System;
11+
using System.Runtime.Serialization;
1112

1213
namespace React.Exceptions
1314
{
1415
/// <summary>
1516
/// Thrown when an error occurs with parsing JSX.
1617
/// </summary>
18+
[Serializable]
1719
public class JsxException : ReactException
1820
{
1921
/// <summary>
@@ -28,5 +30,11 @@ public JsxException(string message) : base(message) { }
2830
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
2931
public JsxException(string message, Exception innerException)
3032
: base(message, innerException) { }
33+
34+
/// <summary>
35+
/// Used by deserialization
36+
/// </summary>
37+
protected JsxException(SerializationInfo info, StreamingContext context)
38+
: base(info, context) { }
3139
}
3240
}

src/React/Exceptions/ReactConfigurationException.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
*/
99

1010
using System;
11+
using System.Runtime.Serialization;
1112

1213
namespace React.Exceptions
1314
{
1415
/// <summary>
1516
/// Thrown when an error occurs while reading a site configuration file.
1617
/// </summary>
18+
[Serializable]
1719
public class ReactConfigurationException : ReactException
1820
{
1921
/// <summary>
@@ -28,5 +30,10 @@ public ReactConfigurationException(string message) : base(message) { }
2830
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
2931
public ReactConfigurationException(string message, Exception innerException)
3032
: base(message, innerException) { }
33+
/// <summary>
34+
/// Used by deserialization
35+
/// </summary>
36+
protected ReactConfigurationException(SerializationInfo info, StreamingContext context)
37+
: base(info, context) { }
3138
}
3239
}

src/React/Exceptions/ReactException.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
*/
99

1010
using System;
11+
using System.Runtime.Serialization;
1112

1213
namespace React.Exceptions
1314
{
1415
/// <summary>
1516
/// Base class for all ReactJS.NET exceptions
1617
/// </summary>
18+
[Serializable]
1719
public class ReactException : Exception
1820
{
1921
/// <summary>
@@ -32,5 +34,11 @@ public ReactException(string message) : base(message) { }
3234
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
3335
public ReactException(string message, Exception innerException)
3436
: base(message, innerException) { }
37+
/// <summary>
38+
/// Used by deserialization
39+
/// </summary>
40+
protected ReactException(SerializationInfo info, StreamingContext context)
41+
: base(info, context)
42+
{ }
3543
}
3644
}

src/React/Exceptions/ReactInvalidComponentException.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
*/
99

1010
using System;
11+
using System.Runtime.Serialization;
1112

1213
namespace React.Exceptions
1314
{
1415
/// <summary>
1516
/// Thrown when a non-existent component is rendered.
1617
/// </summary>
18+
[Serializable]
1719
public class ReactInvalidComponentException : ReactException
1820
{
1921
/// <summary>
@@ -28,5 +30,10 @@ public ReactInvalidComponentException(string message) : base(message) { }
2830
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>
2931
public ReactInvalidComponentException(string message, Exception innerException)
3032
: base(message, innerException) { }
33+
/// <summary>
34+
/// Used by deserialization
35+
/// </summary>
36+
protected ReactInvalidComponentException(SerializationInfo info, StreamingContext context)
37+
: base(info, context) { }
3138
}
3239
}

0 commit comments

Comments
 (0)