PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/src/LinFu.IoC/ServiceNotFoundException.cs

http://github.com/philiplaureano/LinFu
C# | 33 lines | 15 code | 3 blank | 15 comment | 0 complexity | 125c958d09a8ae1bf3e1d1948984802e MD5 | raw file
 1using System;
 2
 3namespace LinFu.IoC
 4{
 5    /// <summary>
 6    ///     The exception thrown when a service type is
 7    ///     requested from a container and that named container
 8    ///     is unable to find or create that particular service instance.
 9    /// </summary>
10    [Serializable]
11    public class ServiceNotFoundException : Exception
12    {
13        private readonly Type _serviceType;
14
15        /// <summary>
16        ///     Initializes the service exception using the
17        ///     given <paramref name="serviceType" /> as
18        ///     the service that was not found.
19        /// </summary>
20        /// <param name="serviceType">The service type being requested.</param>
21        public ServiceNotFoundException(Type serviceType)
22        {
23            _serviceType = serviceType;
24        }
25
26        /// <summary>
27        ///     The error message that this particular exception
28        ///     will display.
29        /// </summary>
30        public override string Message =>
31            string.Format("Service type '{0}' not found", _serviceType.AssemblyQualifiedName);
32    }
33}