Factory used to create a serializeable ErrorDescription from ApplicationException or from arbitrary errors.
Description
The ErrorDescriptionFactory class provides a factory to create a serializeable ErrorDescription from ApplicationException or from arbitrary errors.
Important points
- Error descriptions are used to pass errors through the wire between microservices implemented in different languages. They allow to restore exceptions on the receiving side close to the original type and preserve additional information.
Static methods
Create
Creates a serializable ErrorDescription from an error object.
public static
ErrorDescription Create(ApplicationException error)
- error: ApplicationException - error object
- returns: ErrorDescription - serializeable ErrorDescription object that describes the error.
Create
Creates a serializable ErrorDescription from a throwable object with an unknown error category.
public static
ErrorDescription Create(Exception ex, string correlationId = null)
- ex: Exception - error object
- correlationId: string - (optional) unique transaction id used to trace execution through the call chain.
- returns: ErrorDescription - serializeable ErrorDescription object that describes the error.