-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: InvalidDataException not found problem
Revert "Use standard exception instead of our own" This reverts commit 10d2a1e.
- Loading branch information
Showing
6 changed files
with
89 additions
and
4 deletions.
There are no files selected for viewing
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,25 @@ | ||
using System; | ||
using System.Runtime.Serialization; | ||
|
||
namespace Mirror | ||
{ | ||
|
||
[Serializable] | ||
public class InvalidMessageException : Exception | ||
{ | ||
public InvalidMessageException() | ||
{ | ||
} | ||
|
||
public InvalidMessageException(string message) : base(message) | ||
{ | ||
} | ||
|
||
public InvalidMessageException(string message, Exception innerException) : base(message, innerException) | ||
{ | ||
} | ||
protected InvalidMessageException(SerializationInfo info, StreamingContext context) : base(info, context) | ||
{ | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,40 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Mirror.Tests | ||
{ | ||
[TestFixture] | ||
public class InvalidMessageExceptionTest | ||
{ | ||
[Test] | ||
public void InvalidMessageTest() | ||
{ | ||
Assert.Throws<InvalidMessageException>(() => | ||
{ | ||
throw new InvalidMessageException(); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void InvalidMessageWithTextTest() | ||
{ | ||
InvalidMessageException ex = Assert.Throws<InvalidMessageException>(() => | ||
{ | ||
throw new InvalidMessageException("Test Message"); | ||
}); | ||
|
||
Assert.That(ex.Message, Is.EqualTo("Test Message")); | ||
} | ||
|
||
[Test] | ||
public void InvalidMessageWithTextAndInnerTest() | ||
{ | ||
InvalidMessageException ex = Assert.Throws<InvalidMessageException>(() => | ||
{ | ||
throw new InvalidMessageException("Test Message Too", new System.Exception()); | ||
}); | ||
|
||
Assert.That(ex.Message, Is.EqualTo("Test Message Too")); | ||
Assert.That(ex.InnerException, Is.TypeOf(typeof(System.Exception))); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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