From cf5980863a6a80d20bb8a87c1bc27691aa7af6ae Mon Sep 17 00:00:00 2001 From: Simon Gockner Date: Tue, 4 Jun 2019 22:30:47 +0200 Subject: [PATCH] - add needed exceptions --- .../Exceptions/InternalResolveException.cs | 21 +++++++++++++++ .../InvalidFactoryRegistrationException.cs | 18 +++++++++++++ .../InvalidRegistrationException.cs | 20 ++++++++++++++ .../Exceptions/TypeNotRegisteredException.cs | 26 +++++++++++++++++++ .../UnknownRegistrationException.cs | 21 +++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 LightweightIocContainer/Exceptions/InternalResolveException.cs create mode 100644 LightweightIocContainer/Exceptions/InvalidFactoryRegistrationException.cs create mode 100644 LightweightIocContainer/Exceptions/InvalidRegistrationException.cs create mode 100644 LightweightIocContainer/Exceptions/TypeNotRegisteredException.cs create mode 100644 LightweightIocContainer/Exceptions/UnknownRegistrationException.cs diff --git a/LightweightIocContainer/Exceptions/InternalResolveException.cs b/LightweightIocContainer/Exceptions/InternalResolveException.cs new file mode 100644 index 0000000..fd122b9 --- /dev/null +++ b/LightweightIocContainer/Exceptions/InternalResolveException.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 +{ + /// + /// An internal Error happened while the tried to resolve an instance + /// + public class InternalResolveException : Exception + { + public InternalResolveException(string message) + : base(message) + { + + } + } +} \ No newline at end of file diff --git a/LightweightIocContainer/Exceptions/InvalidFactoryRegistrationException.cs b/LightweightIocContainer/Exceptions/InvalidFactoryRegistrationException.cs new file mode 100644 index 0000000..9e8d644 --- /dev/null +++ b/LightweightIocContainer/Exceptions/InvalidFactoryRegistrationException.cs @@ -0,0 +1,18 @@ +// Author: simon.gockner +// Created: 2019-05-20 +// Copyright(c) 2019 SimonG. All Rights Reserved. + +namespace LightweightIocContainer.Exceptions +{ + /// + /// The registration of a Factory is not valid + /// + public class InvalidFactoryRegistrationException : InvalidRegistrationException + { + public InvalidFactoryRegistrationException(string message) + : base(message) + { + + } + } +} \ No newline at end of file diff --git a/LightweightIocContainer/Exceptions/InvalidRegistrationException.cs b/LightweightIocContainer/Exceptions/InvalidRegistrationException.cs new file mode 100644 index 0000000..718dd53 --- /dev/null +++ b/LightweightIocContainer/Exceptions/InvalidRegistrationException.cs @@ -0,0 +1,20 @@ +// Author: simon.gockner +// Created: 2019-05-20 +// Copyright(c) 2019 SimonG. All Rights Reserved. + +using System; + +namespace LightweightIocContainer.Exceptions +{ + /// + /// The registration is not valid + /// + public class InvalidRegistrationException : Exception + { + public InvalidRegistrationException(string message) + : base(message) + { + + } + } +} \ No newline at end of file diff --git a/LightweightIocContainer/Exceptions/TypeNotRegisteredException.cs b/LightweightIocContainer/Exceptions/TypeNotRegisteredException.cs new file mode 100644 index 0000000..9d88e67 --- /dev/null +++ b/LightweightIocContainer/Exceptions/TypeNotRegisteredException.cs @@ -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 +{ + /// + /// The Type is not registered in this + /// + public class TypeNotRegisteredException : Exception + { + public TypeNotRegisteredException(Type type) + : base($"Type {type.Name} is not registered in this InjectorContainer.") + { + Type = type; + } + + /// + /// The unregistered Type + /// + public Type Type { get; } + } +} \ No newline at end of file diff --git a/LightweightIocContainer/Exceptions/UnknownRegistrationException.cs b/LightweightIocContainer/Exceptions/UnknownRegistrationException.cs new file mode 100644 index 0000000..0e78369 --- /dev/null +++ b/LightweightIocContainer/Exceptions/UnknownRegistrationException.cs @@ -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 +{ + /// + /// An unknown was used + /// + public class UnknownRegistrationException : Exception + { + public UnknownRegistrationException(string message) + : base(message) + { + + } + } +} \ No newline at end of file