- add needed exceptions

pull/32/head
Simon Gockner 7 years ago
parent 8a8aaf8ac3
commit cf5980863a
  1. 21
      LightweightIocContainer/Exceptions/InternalResolveException.cs
  2. 18
      LightweightIocContainer/Exceptions/InvalidFactoryRegistrationException.cs
  3. 20
      LightweightIocContainer/Exceptions/InvalidRegistrationException.cs
  4. 26
      LightweightIocContainer/Exceptions/TypeNotRegisteredException.cs
  5. 21
      LightweightIocContainer/Exceptions/UnknownRegistrationException.cs

@ -0,0 +1,21 @@
// Author: simon.gockner
// Created: 2019-05-27
// Copyright(c) 2019 SimonG. All Rights Reserved.
using System;
using LightweightIocContainer.Interfaces;
namespace LightweightIocContainer.Exceptions
{
/// <summary>
/// An internal Error happened while the <see cref="IInjectorContainer"/> tried to resolve an instance
/// </summary>
public class InternalResolveException : Exception
{
public InternalResolveException(string message)
: base(message)
{
}
}
}

@ -0,0 +1,18 @@
// Author: simon.gockner
// Created: 2019-05-20
// Copyright(c) 2019 SimonG. All Rights Reserved.
namespace LightweightIocContainer.Exceptions
{
/// <summary>
/// The registration of a Factory is not valid
/// </summary>
public class InvalidFactoryRegistrationException : InvalidRegistrationException
{
public InvalidFactoryRegistrationException(string message)
: base(message)
{
}
}
}

@ -0,0 +1,20 @@
// Author: simon.gockner
// Created: 2019-05-20
// Copyright(c) 2019 SimonG. All Rights Reserved.
using System;
namespace LightweightIocContainer.Exceptions
{
/// <summary>
/// The registration is not valid
/// </summary>
public class InvalidRegistrationException : Exception
{
public InvalidRegistrationException(string message)
: base(message)
{
}
}
}

@ -0,0 +1,26 @@
// Author: simon.gockner
// Created: 2019-05-21
// Copyright(c) 2019 SimonG. All Rights Reserved.
using System;
using LightweightIocContainer.Interfaces;
namespace LightweightIocContainer.Exceptions
{
/// <summary>
/// The Type is not registered in this <see cref="IInjectorContainer"/>
/// </summary>
public class TypeNotRegisteredException : Exception
{
public TypeNotRegisteredException(Type type)
: base($"Type {type.Name} is not registered in this InjectorContainer.")
{
Type = type;
}
/// <summary>
/// The unregistered Type
/// </summary>
public Type Type { get; }
}
}

@ -0,0 +1,21 @@
// Author: simon.gockner
// Created: 2019-05-21
// Copyright(c) 2019 SimonG. All Rights Reserved.
using System;
using LightweightIocContainer.Interfaces.Registrations;
namespace LightweightIocContainer.Exceptions
{
/// <summary>
/// An unknown <see cref="IRegistrationBase"/> was used
/// </summary>
public class UnknownRegistrationException : Exception
{
public UnknownRegistrationException(string message)
: base(message)
{
}
}
}
Loading…
Cancel
Save