Remove pointless exception encapsulation

This commit is contained in:
Brendan Le Ny 2024-06-21 11:02:29 +02:00 committed by Alex Morel
parent c793c138a3
commit 3009edf101

View file

@ -70,16 +70,11 @@ public class ScimClient<S extends ResourceNode> implements AutoCloseable {
);
}
Retry retry = retryRegistry.retry("create-%s".formatted(id.asString()));
ServerResponse<S> response = retry.executeSupplier(() -> {
try {
return scimRequestBuilder
ServerResponse<S> response = retry.executeSupplier(() -> scimRequestBuilder
.create(getResourceClass(), getScimEndpoint())
.setResource(scimForCreation)
.sendRequest();
} catch (ResponseException e) {
throw new RuntimeException(e);
}
});
.sendRequest()
);
checkResponseIsSuccess(response);
S resource = response.getResource();
return resource.getId()
@ -104,29 +99,20 @@ public class ScimClient<S extends ResourceNode> implements AutoCloseable {
public void replace(EntityOnRemoteScimId externalId, ResourceNode scimForReplace) {
Retry retry = retryRegistry.retry("replace-%s".formatted(externalId.asString()));
ServerResponse<S> response = retry.executeSupplier(() -> {
try {
return scimRequestBuilder
ServerResponse<S> response = retry.executeSupplier(() -> scimRequestBuilder
.update(getResourceClass(), getScimEndpoint(), externalId.asString())
.setResource(scimForReplace)
.sendRequest();
} catch (ResponseException e) {
throw new RuntimeException(e);
}
});
.sendRequest()
);
checkResponseIsSuccess(response);
}
public void delete(EntityOnRemoteScimId externalId) {
Retry retry = retryRegistry.retry("delete-%s".formatted(externalId.asString()));
ServerResponse<S> response = retry.executeSupplier(() -> {
try {
return scimRequestBuilder.delete(getResourceClass(), getScimEndpoint(), externalId.asString())
.sendRequest();
} catch (ResponseException e) {
throw new RuntimeException(e);
}
});
ServerResponse<S> response = retry.executeSupplier(() -> scimRequestBuilder
.delete(getResourceClass(), getScimEndpoint(), externalId.asString())
.sendRequest()
);
checkResponseIsSuccess(response);
}