}
public PATCHStatusContext patchConfigurationDataWithinTransaction(final PATCHContext context,
- final SchemaContext globalSchema) {
+ final SchemaContext globalSchema)
+ throws TransactionCommitFailedException {
final DOMDataReadWriteTransaction patchTransaction = domDataBroker.newReadWriteTransaction();
List<PATCHStatusEntity> editCollection = new ArrayList<>();
List<RestconfError> editErrors;
//TODO: make sure possible global errors are filled up correctly and decide transaction submission based on that
//globalErrors = new ArrayList<>();
if (errorCounter == 0) {
- final CheckedFuture<Void, TransactionCommitFailedException> submit = patchTransaction.submit();
+ patchTransaction.submit().checkedGet();
return new PATCHStatusContext(context.getPatchId(), ImmutableList.copyOf(editCollection), true,
globalErrors);
} else {
if (context == null) {
throw new RestconfDocumentedException("Input is required.", ErrorType.PROTOCOL, ErrorTag.MALFORMED_MESSAGE);
}
- return broker.patchConfigurationDataWithinTransaction(context, controllerContext.getGlobalSchema());
+ try {
+ return broker.patchConfigurationDataWithinTransaction(context, controllerContext.getGlobalSchema());
+ } catch (TransactionCommitFailedException e) {
+ LOG.debug("Patch transaction failed", e);
+ throw new RestconfDocumentedException(e.getMessage());
+ }
}
@Override
if (context == null) {
throw new RestconfDocumentedException("Input is required.", ErrorType.PROTOCOL, ErrorTag.MALFORMED_MESSAGE);
}
- return broker.patchConfigurationDataWithinTransaction(context, controllerContext.getGlobalSchema());
+ try {
+ return broker.patchConfigurationDataWithinTransaction(context, controllerContext.getGlobalSchema());
+ } catch (TransactionCommitFailedException e) {
+ LOG.debug("Patch transaction failed", e);
+ throw new RestconfDocumentedException(e.getMessage());
+ }
}
/**