PatchFormatException.java

  1. /*
  2.  * Copyright (C) 2012, IBM Corporation and others. and others
  3.  *
  4.  * This program and the accompanying materials are made available under the
  5.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  6.  * https://www.eclipse.org/org/documents/edl-v10.php.
  7.  *
  8.  * SPDX-License-Identifier: BSD-3-Clause
  9.  */
  10. package org.eclipse.jgit.api.errors;

  11. import java.text.MessageFormat;
  12. import java.util.List;

  13. import org.eclipse.jgit.internal.JGitText;
  14. import org.eclipse.jgit.patch.FormatError;

  15. /**
  16.  * Exception thrown when applying a patch fails due to an invalid format
  17.  *
  18.  * @since 2.0
  19.  */
  20. public class PatchFormatException extends GitAPIException {
  21.     private static final long serialVersionUID = 1L;

  22.     private List<FormatError> errors;

  23.     /**
  24.      * Constructor for PatchFormatException
  25.      *
  26.      * @param errors
  27.      *            a {@link java.util.List} of {@link FormatError}s
  28.      */
  29.     public PatchFormatException(List<FormatError> errors) {
  30.         super(MessageFormat.format(JGitText.get().patchFormatException, errors));
  31.         this.errors = errors;
  32.     }

  33.     /**
  34.      * Get list of errors
  35.      *
  36.      * @return all the errors where unresolved conflicts have been detected
  37.      */
  38.     public List<FormatError> getErrors() {
  39.         return errors;
  40.     }

  41. }