Package org.pipservices3.commons.errors
Class ErrorDescriptionFactory
java.lang.Object
org.pipservices3.commons.errors.ErrorDescriptionFactory
Factory to create serializeable
ErrorDescription
from ApplicationException
or from arbitrary errors.
The ErrorDescriptions 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.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ErrorDescription
Creates a serializable ErrorDescription from error object.static ErrorDescription
Creates a serializable ErrorDescription from throwable object with unknown error category.
-
Constructor Details
-
ErrorDescriptionFactory
public ErrorDescriptionFactory()
-
-
Method Details
-
create
Creates a serializable ErrorDescription from error object.- Parameters:
ex
- an error object- Returns:
- a serializeable ErrorDescription object that describes the error.
-
create
Creates a serializable ErrorDescription from throwable object with unknown error category.- Parameters:
ex
- an error objectcorrelationId
- (optional) a unique transaction id to trace execution through call chain.- Returns:
- a serializeable ErrorDescription object that describes the error.
-