Juan Hernandez has uploaded a new change for review.

Change subject: restapi: Return additional info for 400 messages
......................................................................

restapi: Return additional info for 400 messages

This was already done for JAXB exceptions, but is missing for RESTEasy
JAXB marshall exceptions.

Change-Id: I31a7a5f487c662cbcba3734153e9fcb120ba330d
Bug-Url: https://bugzilla.redhat.com/867794
Signed-off-by: Juan Hernandez <[email protected]>
---
M 
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/validation/JaxbMarshallExceptionMapper.java
1 file changed, 6 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/06/26706/1

diff --git 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/validation/JaxbMarshallExceptionMapper.java
 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/validation/JaxbMarshallExceptionMapper.java
index c853be4..fb74e50 100644
--- 
a/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/validation/JaxbMarshallExceptionMapper.java
+++ 
b/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/validation/JaxbMarshallExceptionMapper.java
@@ -1,10 +1,5 @@
 package org.ovirt.engine.api.restapi.resource.validation;
 
-import org.jboss.resteasy.annotations.interception.ServerInterceptor;
-import org.jboss.resteasy.plugins.providers.jaxb.JAXBMarshalException;
-import org.ovirt.engine.api.model.Fault;
-
-import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Application;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Request;
@@ -13,6 +8,9 @@
 import javax.ws.rs.core.UriInfo;
 import javax.ws.rs.ext.ExceptionMapper;
 import javax.ws.rs.ext.Provider;
+
+import org.jboss.resteasy.annotations.interception.ServerInterceptor;
+import org.jboss.resteasy.plugins.providers.jaxb.JAXBMarshalException;
 
 @Provider
 @ServerInterceptor
@@ -27,15 +25,8 @@
 
     @Override
     public Response toResponse(JAXBMarshalException ex) {
-        try {
-            Fault fault = new Fault();
-            fault.setReason("Bad Request");
-            fault.setDetail(ex.getCause().getMessage());
-            return Response.status(Status.BAD_REQUEST)
-                    .entity(fault)
-                    .build();
-        } catch (Exception e) {
-            throw new WebApplicationException(e, 
Response.status(Status.INTERNAL_SERVER_ERROR).build());
-        }
+        return Response.status(Status.BAD_REQUEST)
+            .entity(new UsageFinder().getUsageMessage(application, uriInfo, 
request))
+            .build();
     }
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31a7a5f487c662cbcba3734153e9fcb120ba330d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to