Skip to content

Instantly share code, notes, and snippets.

@caponetto
Last active Sep 11, 2020
Embed
What would you like to do?
Backend sample service: Calling and handling the service response in the editor
SampleServiceWrapper.get().hello("Guilherme", 5000).then((CapabilityResponse<String> response) -> {
// Sample - capability not available can be handled like this.
if (CapabilityResponseStatus.withName(response.getStatus()) == CapabilityResponseStatus.NOT_AVAILABLE) {
DomGlobal.console.info(response.getMessage());
}
// Sample - response completed can be handled like this.
if (CapabilityResponseStatus.withName(response.getStatus()) == CapabilityResponseStatus.OK) {
DomGlobal.console.info(response.getBody());
}
return null;
}).catch_(error -> {
DomGlobal.console.error("Error caught: " + error);
return null;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment