Project

General

Profile

« Previous | Next » 

Revision 61685

catching email exceptions

View differences:

modules/uoa-repository-manager-service/branches/springboot/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java
486 486
    }
487 487

  
488 488
    @Override
489
    public Repository addRepository(String datatype,
490
                                    Repository repository) throws Exception {
489
    public Repository addRepository(String datatype, Repository repository) throws Exception {
491 490

  
492 491
        LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
493 492

  
......
558 557
        ResponseEntity responseEntity = restTemplate.exchange(uriComponents.toUri(), HttpMethod.POST, httpEntity, ResponseEntity.class);
559 558

  
560 559
        if (responseEntity.getStatusCode().equals(HttpStatus.OK)) {
561
            emailUtils.sendUserRegistrationEmail(repository, authentication);
562
            emailUtils.sendAdminRegistrationEmail(repository, authentication);
560
            try {
561
                emailUtils.sendUserRegistrationEmail(repository, authentication);
562
                emailUtils.sendAdminRegistrationEmail(repository, authentication);
563
            } catch (Exception e) {
564
                LOGGER.error("Error sending email", e);
565
            }
563 566
        } else
564
            LOGGER.debug(responseEntity.getBody().toString());
567
            LOGGER.error("Error storing repository: " + responseEntity.getBody().toString());
565 568

  
566 569
        return repository;
567

  
568

  
569 570
    }
570 571

  
571 572
    @Override

Also available in: Unified diff