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