fixed a bug on Exception catching on Collector stubs

This commit is contained in:
Lucio Lelii 2020-04-08 16:45:56 +02:00
parent 1626dddc97
commit ee9e001fcc
1 changed files with 8 additions and 7 deletions

View File

@ -51,7 +51,7 @@ public class CollectorStubs implements RegistryStub {
if (connection.getResponseCode()!=200) throw new CreateException("error creating resource "+connection.getResponseCode());
}catch (Exception e) {
log.error("error on create",e);
throw new RemoveException(e.getMessage());
throw new CreateException(e.getMessage());
}
}
@ -74,7 +74,7 @@ public class CollectorStubs implements RegistryStub {
if (connection.getResponseCode()!=200) throw new UpdateException("error updating resource "+connection.getResponseCode());
}catch (Exception e) {
log.error("error on update",e);
throw new RemoveException(e.getMessage());
throw new UpdateException(e.getMessage());
}
}
@ -91,11 +91,12 @@ public class CollectorStubs implements RegistryStub {
log.info("response code is not 200");
if (connection.getResponseCode()==404)
throw new ResourceDoesNotExistException("resource with id "+id+" not found");
else throw new RemoveException("error removing resource with id "+id);
else throw new RemoveException("generic error removing resource "+id);
}
}catch (ResourceDoesNotExistException | RemoveException e) {
throw e;
}catch (Exception e) {
log.error("error on remove",e);
throw new RemoveException(e.getMessage());
throw new RemoveException("connection error removing resource");
}
}