ATLAS-1611: Regression: Incorrect error code for the negative tests, returned: 500 server error, expected: 400 bad request
diff --git a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
index 8328da5..19c5594 100755
--- a/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
+++ b/webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
@@ -1190,8 +1190,14 @@
         return jsonArray;
     }
 
-    private AtlasEntityType getEntityType(String typeName) {
-        return typeRegistry.getEntityTypeByName(typeName);
+    private AtlasEntityType getEntityType(String typeName) throws AtlasBaseException {
+        AtlasEntityType ret = typeRegistry.getEntityTypeByName(typeName);
+
+        if (ret == null) {
+            throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_NOT_FOUND, typeName);
+        }
+
+        return ret;
     }
 
     public static WebApplicationException toWebApplicationException(AtlasBaseException e) {