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
exceptionsIEnumerable<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
originalTypeTypeThe original exception which will be translated.
translatedTypeTypeThe target exception which replaces the original.
Exceptions
- ArgumentException
Thrown when
originalTypeisn't assignable from Exception ortranslatedTypeisn't assignable from Exception ortranslatedTypehas not a constructor with one parameter of typeoriginalType.
Translate(Exception)
Translate the exception to the defined one.
public Exception Translate(Exception ex)
Parameters
exExceptionException to translate.
Returns
- Exception
Translated Exception when in dictionary.
Exceptions
- ArgumentNullException
Thrown when
exis null.