Improved exception throwing

This commit is contained in:
Luca Frosini 2022-11-04 11:17:24 +01:00
parent 67006b8f67
commit f8e6a0cc43
1 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package org.gcube.gcat.rest;
import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.Response.Status;
@ -29,8 +30,10 @@ public class REST<C extends CKAN> extends BaseREST implements CRUD<Response,Resp
C ckan = reference.newInstance();
ckan.setUriInfo(uriInfo);
return ckan;
} catch (WebApplicationException e) {
throw e;
} catch(Exception e) {
throw new InternalServerErrorException();
throw new InternalServerErrorException(e);
}
}