/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

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