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 System.Runtime.Serialization;
11 :
12 : namespace Cqrs.Domain.Exceptions
13 : {
14 : /// <summary>
15 : /// The <see cref="ISaga{TAuthenticationToken}"/> requested was not found.
16 : /// </summary>
17 : /// <typeparam name="TSaga">The <see cref="Type"/> of the <see cref="ISaga{TAuthenticationToken}"/> that wasn't found.</typeparam>
18 : /// <typeparam name="TAuthenticationToken">The <see cref="Type"/> of the authentication token.</typeparam>
19 : [Serializable]
20 : public class SagaNotFoundException<TSaga, TAuthenticationToken> : Exception
21 : where TSaga : ISaga<TAuthenticationToken>
22 1 : {
23 : /// <summary>
24 : /// Instantiate a new instance of <see cref="SagaNotFoundException{TSaga,TAuthenticationToken}"/> with the provided identifier of the <see cref="ISaga{TAuthenticationToken}"/> that wasn't found.
25 : /// </summary>
26 : /// <param name="id">The identifier of the <see cref="ISaga{TAuthenticationToken}"/> that wasn't found.</param>
27 1 : public SagaNotFoundException(Guid id)
28 : : base(string.Format("Saga '{0}' of type '{1}' was not found", id, typeof(TSaga).FullName))
29 : {
30 : Id = id;
31 : SagaType = typeof(TSaga);
32 : }
33 :
34 : /// <summary>
35 : /// The identifier of the <see cref="ISaga{TAuthenticationToken}"/> that wasn't found.
36 : /// </summary>
37 : [DataMember]
38 : public Guid Id { get; set; }
39 :
40 : /// <summary>
41 : /// The <see cref="Type"/> of the <see cref="ISaga{TAuthenticationToken}"/> that wasn't found.
42 : /// </summary>
43 : [DataMember]
44 : public Type SagaType { get; set; }
45 : }
46 : }
|