Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardized error messages between convention and registration-base …
…event routers.
- Loading branch information
Oliver, Jonathan
committed
Jul 28, 2011
1 parent
271c862
commit cd09fe6
Showing
4 changed files
with
34 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
namespace CommonDomain.Core | ||
{ | ||
using System.Globalization; | ||
|
||
internal static class ExtensionMethods | ||
{ | ||
public static string FormatWith(this string format, params object[] args) | ||
{ | ||
return string.Format(CultureInfo.InvariantCulture, format ?? string.Empty, args); | ||
} | ||
|
||
public static void ThrowHandlerNotFound(this IAggregate aggregate, object eventMessage) | ||
{ | ||
var exceptionMessage = "Aggregate of type '{0}' raised an event of type '{1}' but not handler could be found to handle the message." | ||
.FormatWith(aggregate.GetType().Name, eventMessage.GetType().Name); | ||
|
||
throw new HandlerForDomainEventNotFoundException(exceptionMessage); | ||
} | ||
} | ||
} |
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