Package io.fluxcapacitor.common.api
Class ErrorResult
java.lang.Object
io.fluxcapacitor.common.api.ErrorResult
- All Implemented Interfaces:
JsonType
,RequestResult
A generic error response returned when a request could not be completed successfully.
Contains a textual error message explaining the failure. This class is often returned in place of the expected
RequestResult
if an error occurs in the Flux platform or client.
Exception Behavior
If anErrorResult
is received for a Request
, the associated CompletableFuture
will be
completed exceptionally with a ServiceException
that wraps the error message. This allows applications to
handle errors via standard future.exceptionally(...)
mechanisms.
keyValueClient.send(new GetValue("missingKey"))
.exceptionally(error -> {
if (error instanceof ServiceException) {
log.warn("Failed: " + error.getMessage());
}
return null;
});
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.common.api.RequestResult
getRequestId, getTimestamp
-
Constructor Details
-
ErrorResult
public ErrorResult()
-