Idan Shaby has uploaded a new change for review. Change subject: core: Throwing exception instead of handle fault ......................................................................
core: Throwing exception instead of handle fault CommandBase -> executeWithoutTransaction already handles a VdcBLLException by calling processExceptionToClient. So AddStorageServerConnectionCommand should throw an exception with a right error message, and this way both UI and REST api get the same response. Change-Id: I3e6b8282d9e2cdd6e17f21a2ef034041d68d09fc Bug-Url: https://bugzilla.redhat.com/1108164 Signed-off-by: Idan Shaby <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java 1 file changed, 2 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/59/29259/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java index 829374f..10e336e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/AddStorageServerConnectionCommand.java @@ -12,9 +12,9 @@ import org.ovirt.engine.core.common.businessentities.StorageServerConnections; import org.ovirt.engine.core.common.businessentities.StorageType; import org.ovirt.engine.core.common.businessentities.VDSStatus; +import org.ovirt.engine.core.common.errors.VdcBLLException; import org.ovirt.engine.core.common.errors.VdcBllErrors; import org.ovirt.engine.core.common.errors.VdcBllMessages; -import org.ovirt.engine.core.common.errors.VdcFault; import org.ovirt.engine.core.common.locks.LockingGroup; import org.ovirt.engine.core.common.utils.Pair; import org.ovirt.engine.core.common.validation.NfsMountPointConstraint; @@ -41,10 +41,7 @@ // Process failure if (!isValidConnection) { - VdcFault fault = new VdcFault(); - fault.setError(VdcBllErrors.forValue(result.getSecond())); - getReturnValue().setFault(fault); - success = false; + throw new VdcBLLException(VdcBllErrors.forValue(result.getSecond())); } } -- To view, visit http://gerrit.ovirt.org/29259 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3e6b8282d9e2cdd6e17f21a2ef034041d68d09fc Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Idan Shaby <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
