-
Notifications
You must be signed in to change notification settings - Fork 966
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from MehdiK/null-DehumanizeTo
Adds NoMatch to DehumanizeTo & renames NoMatchFoundException
- Loading branch information
Showing
7 changed files
with
73 additions
and
44 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
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
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
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,24 @@ | ||
using System; | ||
|
||
namespace Humanizer | ||
{ | ||
/// <summary> | ||
/// This is thrown on String.DehumanizeTo enum when the provided string cannot be mapped to the target enum | ||
/// </summary> | ||
public class NoMatchFoundException : Exception | ||
{ | ||
public NoMatchFoundException() | ||
{ | ||
} | ||
|
||
public NoMatchFoundException(string message) | ||
: base(message) | ||
{ | ||
} | ||
|
||
public NoMatchFoundException(string message, Exception inner) | ||
: base(message, inner) | ||
{ | ||
} | ||
} | ||
} |
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,18 @@ | ||
namespace Humanizer | ||
{ | ||
/// <summary> | ||
/// Dictating what should be done when a match is not found - currently used only for DehumanizeTo | ||
/// </summary> | ||
public enum OnNoMatch | ||
{ | ||
/// <summary> | ||
/// This is the default behavior which throws a NoMatchFoundException | ||
/// </summary> | ||
ThrowsException, | ||
|
||
/// <summary> | ||
/// If set to ReturnsNull the method returns null instead of throwing an exception | ||
/// </summary> | ||
ReturnsNull | ||
} | ||
} |