Fixing exception management

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@144251 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-02-24 11:01:33 +00:00
parent dbab124043
commit 3e7084ae57
1 changed files with 4 additions and 6 deletions

View File

@ -11,9 +11,8 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.er.ERNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
import org.gcube.informationsystem.resourceregistry.er.ERManagement; import org.gcube.informationsystem.resourceregistry.er.ERManagement;
@ -88,7 +87,7 @@ public class Access {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String getInstance(@PathParam(TYPE_PATH_PARAM) String type, public String getInstance(@PathParam(TYPE_PATH_PARAM) String type,
@PathParam(ID_PATH_PARAM) String id) @PathParam(ID_PATH_PARAM) String id)
throws ResourceRegistryException { throws ERNotFoundException, ResourceRegistryException {
logger.info("Requested {} with id {}", type, id); logger.info("Requested {} with id {}", type, id);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@ -116,7 +115,7 @@ public class Access {
@QueryParam(AccessPath.POLYMORPHIC_PARAM) Boolean polymorphic, @QueryParam(AccessPath.POLYMORPHIC_PARAM) Boolean polymorphic,
@QueryParam(AccessPath.REFERENCE) String reference, @QueryParam(AccessPath.REFERENCE) String reference,
@QueryParam(AccessPath.DIRECTION) String direction) @QueryParam(AccessPath.DIRECTION) String direction)
throws FacetNotFoundException, ResourceRegistryException { throws ResourceRegistryException {
logger.info("Requested {} ({}={}) instances", type, logger.info("Requested {} ({}={}) instances", type,
AccessPath.POLYMORPHIC_PARAM, polymorphic); AccessPath.POLYMORPHIC_PARAM, polymorphic);
@ -174,8 +173,7 @@ public class Access {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String getSchema(@PathParam(TYPE_PATH_PARAM) String type, public String getSchema(@PathParam(TYPE_PATH_PARAM) String type,
@QueryParam(AccessPath.POLYMORPHIC_PARAM) Boolean polymorphic) @QueryParam(AccessPath.POLYMORPHIC_PARAM) Boolean polymorphic)
throws SchemaNotFoundException, SchemaException, throws SchemaNotFoundException, ResourceRegistryException {
ResourceRegistryException {
logger.info("Requested Schema for type {}", type); logger.info("Requested Schema for type {}", type);
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();