improved exception

This commit is contained in:
Francesco Mangiacrapa 2021-04-08 12:19:55 +02:00
parent 70558e9f8b
commit e2f9b075fa
1 changed files with 7 additions and 1 deletions

View File

@ -31,6 +31,7 @@ import org.gcube.common.resources.gcore.ServiceEndpoint.AccessPoint;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.datatransfer.resolver.requesthandler.RequestHandler;
import org.gcube.datatransfer.resolver.services.error.ExceptionManager;
import org.gcube.datatransfer.resolver.services.exceptions.NotFoundException;
import org.gcube.datatransfer.resolver.util.Util;
import org.gcube.resources.discovery.client.api.DiscoveryClient;
import org.gcube.resources.discovery.client.queries.api.SimpleQuery;
@ -233,7 +234,8 @@ public class WekeoResolver {
if(toReturn.size()==0){
String errorMessage = String.format("Missing the RR with Name '%s' and Category '%s' in the scope '%s'. Please contact the support.",RUNTIME_WKEO_RESOURCE_NAME,CATEGORY_WEKEO_TYPE,ScopeProvider.instance.get());
logger.error(errorMessage);
throw ExceptionManager.internalErrorException(req, errorMessage, WekeoResolver.class, helpURI);
throw ExceptionManager.notFoundException(req, errorMessage, WekeoResolver.class, helpURI);
}
String wekeoUsername = null;
@ -253,6 +255,10 @@ public class WekeoResolver {
return null;
}catch(Exception e){
if(e instanceof NotFoundException)
throw e;
String errorMessage = "Error occurred on reading the "+RUNTIME_WKEO_RESOURCE_NAME+" SE registered in the scope: "+ScopeProvider.instance.get();
logger.error(errorMessage, e);
throw ExceptionManager.internalErrorException(req, errorMessage, WekeoResolver.class, helpURI);