Skip to content

Commit

Permalink
feature: eclipse-tractusx/traceability-foss#639 add catch clause
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-lcapellino committed Jun 17, 2024
1 parent 6657e38 commit ceae6f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.eclipse.tractusx.irs.data.JsonParseException;
import org.eclipse.tractusx.irs.edc.client.EdcSubmodelFacade;
import org.eclipse.tractusx.irs.edc.client.exceptions.EdcClientException;
import org.eclipse.tractusx.irs.edc.client.exceptions.UsagePolicyExpiredException;
import org.eclipse.tractusx.irs.edc.client.exceptions.UsagePolicyPermissionException;
import org.eclipse.tractusx.irs.edc.client.relationships.RelationshipAspect;
import org.eclipse.tractusx.irs.registryclient.discovery.ConnectorEndpointsService;
Expand Down Expand Up @@ -115,7 +116,13 @@ private void processEndpoint(final Endpoint endpoint, final RelationshipAspect r
itemContainerBuilder.relationships(relationships);
itemContainerBuilder.bpns(getBpnsFrom(relationships));
} catch (final UsagePolicyPermissionException e) {
log.info("Encountered usage policy exception: {}. Creating Tombstone.", e.getMessage());
log.info("Encountered usage policy permission exception: {}. Creating Tombstone.", e.getMessage());
itemContainerBuilder.tombstone(
Tombstone.from(itemId.getGlobalAssetId(), endpoint.getProtocolInformation().getHref(), e, 0,
ProcessStep.USAGE_POLICY_VALIDATION, e.getBusinessPartnerNumber(),
jsonUtil.asMap(e.getPolicy())));
} catch (final UsagePolicyExpiredException e) {
log.info("Encountered usage policy expired exception: {}. Creating Tombstone.", e.getMessage());
itemContainerBuilder.tombstone(
Tombstone.from(itemId.getGlobalAssetId(), endpoint.getProtocolInformation().getHref(), e, 0,
ProcessStep.USAGE_POLICY_VALIDATION, e.getBusinessPartnerNumber(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.eclipse.tractusx.irs.data.JsonParseException;
import org.eclipse.tractusx.irs.edc.client.EdcSubmodelFacade;
import org.eclipse.tractusx.irs.edc.client.exceptions.EdcClientException;
import org.eclipse.tractusx.irs.edc.client.exceptions.UsagePolicyExpiredException;
import org.eclipse.tractusx.irs.edc.client.exceptions.UsagePolicyPermissionException;
import org.eclipse.tractusx.irs.registryclient.discovery.ConnectorEndpointsService;
import org.eclipse.tractusx.irs.semanticshub.SemanticsHubFacade;
Expand Down Expand Up @@ -143,7 +144,12 @@ private List<Submodel> getSubmodels(final SubmodelDescriptor submodelDescriptor,
ProcessStep.SCHEMA_REQUEST));
log.info("Cannot load JSON schema for validation. Creating Tombstone.");
} catch (final UsagePolicyPermissionException e) {
log.info("Encountered usage policy exception: {}. Creating Tombstone.", e.getMessage());
log.info("Encountered usage policy permission exception: {}. Creating Tombstone.", e.getMessage());
itemContainerBuilder.tombstone(Tombstone.from(itemId, endpoint.getProtocolInformation().getHref(), e, 0,
ProcessStep.USAGE_POLICY_VALIDATION, e.getBusinessPartnerNumber(),
jsonUtil.asMap(e.getPolicy())));
} catch (final UsagePolicyExpiredException e) {
log.info("Encountered usage policy expired exception: {}. Creating Tombstone.", e.getMessage());
itemContainerBuilder.tombstone(Tombstone.from(itemId, endpoint.getProtocolInformation().getHref(), e, 0,
ProcessStep.USAGE_POLICY_VALIDATION, e.getBusinessPartnerNumber(),
jsonUtil.asMap(e.getPolicy())));
Expand Down

0 comments on commit ceae6f4

Please sign in to comment.