Class ExceptionTranslator
- Namespace
- Loehnert.Lisrt.Messaging.Exceptions
- Assembly
- Loehnert.Lisrt.dll
A Translator for exceptions to L-exceptions.
public class ExceptionTranslator
- Inheritance
-
ExceptionTranslator
- Inherited Members
Constructors
ExceptionTranslator(IEnumerable<ITranslatableException>)
Initializes a new instance of the ExceptionTranslator class.
public ExceptionTranslator(IEnumerable<ITranslatableException> exceptions)
Parameters
exceptions
IEnumerable<ITranslatableException>Exceptions for translation.
Exceptions
- ArgumentNullException
Thrown when exception is null.
Methods
Add(Type, Type)
Adds an message translation to the translator.
public void Add(Type originalType, Type translatedType)
Parameters
originalType
TypeThe original exception which will be translated.
translatedType
TypeThe target exception which replaces the original.
Exceptions
- ArgumentException
Thrown when
originalType
isn't assignable from Exception ortranslatedType
isn't assignable from Exception ortranslatedType
has not a constructor with one parameter of typeoriginalType
.
Translate(Exception)
Translate the exception to the defined one.
public Exception Translate(Exception ex)
Parameters
ex
ExceptionException to translate.
Returns
- Exception
Translated Exception when in dictionary.
Exceptions
- ArgumentNullException
Thrown when
ex
is null.