use of io.gravitee.management.service.exceptions.TenantNotFoundException in project gravitee-management-rest-api by gravitee-io.
the class TenantServiceImpl method findById.
@Override
public TenantEntity findById(String tenantId) {
try {
LOGGER.debug("Find tenant by ID: {}", tenantId);
Optional<Tenant> optTenant = tenantRepository.findById(tenantId);
if (!optTenant.isPresent()) {
throw new TenantNotFoundException(tenantId);
}
return convert(optTenant.get());
} catch (TechnicalException ex) {
LOGGER.error("An error occurs while trying to find tenant by ID", ex);
throw new TechnicalManagementException("An error occurs while trying to find tenant by ID", ex);
}
}
Aggregations