-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71cef60
commit 43fdc34
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/Anexia.E5E/Exceptions/E5EInvalidConversionException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using Anexia.E5E.Functions; | ||
|
||
namespace Anexia.E5E.Exceptions; | ||
|
||
/// <summary> | ||
/// Thrown when a <see cref="E5EEvent" /> is converted into the wrong format. | ||
/// </summary> | ||
public class E5EInvalidConversionException :E5EException | ||
{ | ||
/// <summary> | ||
/// The required data type for this conversion call. | ||
/// </summary> | ||
public E5ERequestDataType Expected { get; } | ||
|
||
/// <summary> | ||
/// The actual data type. | ||
/// </summary> | ||
public E5ERequestDataType Actual { get; } | ||
|
||
internal E5EInvalidConversionException(E5ERequestDataType expected, E5ERequestDataType actual) | ||
: base($"Cannot convert data of type {actual} into the type {expected}") | ||
{ | ||
Expected = expected; | ||
Actual = actual; | ||
} | ||
|
||
internal static void ThrowIfNotMatch(E5ERequestDataType expected, E5ERequestDataType actual) | ||
{ | ||
if (expected != actual) | ||
throw new E5EInvalidConversionException(expected, actual); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters