Class ErrorResult

java.lang.Object
io.fluxcapacitor.common.api.ErrorResult
All Implemented Interfaces:
JsonType, RequestResult

public class ErrorResult extends Object implements 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 an ErrorResult 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 Details

    • ErrorResult

      public ErrorResult()