Catch multiple exceptions in REST views
Change-Id: I62eb25317656758b4b21ca68261edb70392c9458
This commit is contained in:
		@@ -124,10 +124,7 @@ public class CreateEmail implements RestModifyView<AccountResource, Input> {
 | 
			
		||||
      try {
 | 
			
		||||
        registerNewEmailFactory.create(email).send();
 | 
			
		||||
        info.pendingConfirmation = true;
 | 
			
		||||
      } catch (EmailException e) {
 | 
			
		||||
        log.error("Cannot send email verification message to " + email, e);
 | 
			
		||||
        throw e;
 | 
			
		||||
      } catch (RuntimeException e) {
 | 
			
		||||
      } catch (EmailException | RuntimeException e) {
 | 
			
		||||
        log.error("Cannot send email verification message to " + email, e);
 | 
			
		||||
        throw e;
 | 
			
		||||
      }
 | 
			
		||||
 
 | 
			
		||||
@@ -101,14 +101,11 @@ class EditMessage implements RestModifyView<RevisionResource, Input>,
 | 
			
		||||
          patchSetInserterFactory));
 | 
			
		||||
    } catch (InvalidChangeOperationException e) {
 | 
			
		||||
      throw new BadRequestException(e.getMessage());
 | 
			
		||||
    } catch (MissingObjectException e) {
 | 
			
		||||
      throw new ResourceConflictException(e.getMessage());
 | 
			
		||||
    } catch (IncorrectObjectTypeException e) {
 | 
			
		||||
      throw new ResourceConflictException(e.getMessage());
 | 
			
		||||
    } catch (PatchSetInfoNotAvailableException e) {
 | 
			
		||||
      throw new ResourceConflictException(e.getMessage());
 | 
			
		||||
    } catch (NoSuchChangeException e) {
 | 
			
		||||
      throw new ResourceNotFoundException();
 | 
			
		||||
    } catch (MissingObjectException | IncorrectObjectTypeException
 | 
			
		||||
        | PatchSetInfoNotAvailableException e) {
 | 
			
		||||
      throw new ResourceConflictException(e.getMessage());
 | 
			
		||||
    } finally {
 | 
			
		||||
      git.close();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -162,9 +162,7 @@ class Files implements ChildCollection<RevisionResource, FileResource> {
 | 
			
		||||
          if (!o.isEmpty()) {
 | 
			
		||||
            try {
 | 
			
		||||
              r = copy(Sets.newHashSet(o), old, resource, userId);
 | 
			
		||||
            } catch (IOException e) {
 | 
			
		||||
              log.warn("Cannot copy patch review flags", e);
 | 
			
		||||
            } catch (PatchListNotAvailableException e) {
 | 
			
		||||
            } catch (IOException | PatchListNotAvailableException e) {
 | 
			
		||||
              log.warn("Cannot copy patch review flags", e);
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
 
 | 
			
		||||
@@ -179,13 +179,7 @@ public class Mergeable implements RestReadView<RevisionResource> {
 | 
			
		||||
        indexer.index(c);
 | 
			
		||||
      }
 | 
			
		||||
      return mergeable;
 | 
			
		||||
    } catch (MergeException e) {
 | 
			
		||||
      return false;
 | 
			
		||||
    } catch (IOException e) {
 | 
			
		||||
      log.error(String.format(
 | 
			
		||||
          "Cannot merge test change %d", change.getId().get()), e);
 | 
			
		||||
      return false;
 | 
			
		||||
    } catch (NoSuchProjectException e) {
 | 
			
		||||
    } catch (MergeException | IOException | NoSuchProjectException e) {
 | 
			
		||||
      log.error(String.format(
 | 
			
		||||
          "Cannot merge test change %d", change.getId().get()), e);
 | 
			
		||||
      return false;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user