Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System;
10 : using Cqrs.Messages;
11 :
12 : namespace Cqrs.Exceptions
13 : {
14 : /// <summary>
15 : /// The <see cref="Exception"/> that is thrown when more than one <see cref="IHandler"/> if found for a given <see cref="IMessage"/> that only expects one.
16 : /// </summary>
17 : [Serializable]
18 : public abstract class MultipleHandlersRegisteredException : InvalidOperationException
19 1 : {
20 : /// <summary>
21 : /// Instantiates a new instance of <see cref="MultipleHandlersRegisteredException"/>.
22 : /// </summary>
23 : /// <param name="type">The <see cref="Type"/> of <see cref="IMessage"/> that expected only one <see cref="IHandler"/>.</param>
24 1 : protected MultipleHandlersRegisteredException(Type type)
25 : : base(string.Format("More than one handler is registered for type '{0}'. You cannot send to more than one handler.", type.FullName))
26 : {
27 : }
28 :
29 : /// <summary>
30 : /// Instantiates a new instance of <see cref="MultipleHandlersRegisteredException"/> with a specified error message.
31 : /// </summary>
32 : /// <param name="message">The message that describes the error.</param>
33 1 : protected MultipleHandlersRegisteredException(string message)
34 : : base(message)
35 : {
36 : }
37 : }
38 : }
|