Commit de6122fa by apoorvnaik Committed by Suma Shivaprasad

ATLAS-1355: Fix for bad error translation from V2 API

parent 78c835ed
...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al ...@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai) ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES: ALL CHANGES:
ATLAS-1355: Fix for bad error translation from V2 API (apoorvnaik via sumasai)
ATLAS-1351 HiveHook fails with NPE for hive process registration (vimalsharma via sumasai) ATLAS-1351 HiveHook fails with NPE for hive process registration (vimalsharma via sumasai)
ATLAS-1342 Titan Solrclient - Add timeouts for zookeeper connect and session (sumasai) ATLAS-1342 Titan Solrclient - Add timeouts for zookeeper connect and session (sumasai)
ATLAS-1353 Invalid error message(500 internal server error) for lineage query on non-existing table. (sumasai) ATLAS-1353 Invalid error message(500 internal server error) for lineage query on non-existing table. (sumasai)
......
...@@ -121,6 +121,9 @@ public class TypesResource { ...@@ -121,6 +121,9 @@ public class TypesResource {
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
LOG.error("Unable to persist types", e); LOG.error("Unable to persist types", e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST)); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (WebApplicationException e) {
LOG.error("Unable to persist types due to V2 API error", e);
throw e;
} catch (Throwable e) { } catch (Throwable e) {
LOG.error("Unable to persist types", e); LOG.error("Unable to persist types", e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR)); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
...@@ -168,6 +171,9 @@ public class TypesResource { ...@@ -168,6 +171,9 @@ public class TypesResource {
} catch (AtlasException | IllegalArgumentException e) { } catch (AtlasException | IllegalArgumentException e) {
LOG.error("Unable to persist types", e); LOG.error("Unable to persist types", e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST)); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (WebApplicationException e) {
LOG.error("Unable to persist types due to V2 API error", e);
throw e;
} catch (Throwable e) { } catch (Throwable e) {
LOG.error("Unable to persist types", e); LOG.error("Unable to persist types", e);
throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR)); throw new WebApplicationException(Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
package org.apache.atlas.web.rest; package org.apache.atlas.web.rest;
import com.google.inject.Inject; import com.google.inject.Inject;
import org.apache.atlas.exception.AtlasBaseException; import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.SearchFilter; import org.apache.atlas.model.SearchFilter;
import org.apache.atlas.model.typedef.AtlasClassificationDef; import org.apache.atlas.model.typedef.AtlasClassificationDef;
...@@ -38,9 +37,6 @@ import org.apache.http.annotation.Experimental; ...@@ -38,9 +37,6 @@ import org.apache.http.annotation.Experimental;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.Set;
import javax.inject.Singleton; import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes; import javax.ws.rs.Consumes;
...@@ -54,6 +50,8 @@ import javax.ws.rs.Produces; ...@@ -54,6 +50,8 @@ import javax.ws.rs.Produces;
import javax.ws.rs.WebApplicationException; import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.util.List;
import java.util.Set;
@Path("v2/types") @Path("v2/types")
...@@ -457,7 +455,7 @@ public class TypesREST { ...@@ -457,7 +455,7 @@ public class TypesREST {
try { try {
ret = typeDefStore.updateTypesDef(typesDef); ret = typeDefStore.updateTypesDef(typesDef);
} catch (AtlasBaseException ex) { } catch (AtlasBaseException ex) {
throw new WebApplicationException(Servlets.getErrorResponse(ex, Response.Status.NOT_MODIFIED)); throw new WebApplicationException(Servlets.getErrorResponse(ex, ex.getAtlasErrorCode().getHttpCode()));
} }
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment