Michael Pasternak has posted comments on this change.

Change subject: restapi - #755579: Return proper http status for errors
......................................................................


Patch Set 5: (2 inline comments)

....................................................
File 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendResource.java
Line 50:             VdcQueryReturnValue result = runQuery(VdcQueryType.Search,
Line 51:                                                           new 
SearchParameters(constraint, searchType));
Line 52:             if (!result.getSucceeded()) {
Line 53:                 throw new 
BackendFailureException(localize(result.getExceptionString()),
Line 54:                         
ErrorMessageHelper.getErrorStatus(result.getExceptionString()));
i'd suggest moving BackendFailureException generation in to dedicated method, 
this way you can use your internal logic in this method instead of expecting 
everyone
throwing it will use it as well.

backendFailure(result.getExceptionString());

backendFailure(message) {

  throw new BackendFailureException(
  
  localize(message),
  
  ErrorMessageHelper.getErrorStatus(message)
  
  );

}
Line 55:             }
Line 56: 
Line 57:             T entity;
Line 58:             if (List.class.isAssignableFrom(clz) && 
result.getReturnValue() instanceof List) {


....................................................
File 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/exception/UrlParamException.java
Line 4: 
Line 5: import org.ovirt.engine.api.restapi.resource.BaseBackendResource;
Line 6: import 
org.ovirt.engine.api.restapi.resource.BaseBackendResource.WebFaultException;
Line 7: 
Line 8: public class UrlParamException extends WebFaultException {
this file is not a a part of this change, please remove it.
Line 9: 
Line 10:     private static final long serialVersionUID = -3881302325152395060L;
Line 11: 
Line 12:     public UrlParamException(BaseBackendResource resource, Exception 
cause, String detail) {


--
To view, visit http://gerrit.ovirt.org/14498
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I395e4b303eda174360ece709ddd7de6b1e3ce93f
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ori Liel <ol...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Michael Pasternak <mpast...@redhat.com>
Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com>
Gerrit-Reviewer: Ori Liel <ol...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to