CommandFailedException.java

  1. /*
  2.  * Copyright (C) 2016, Matthias Sohn <matthias.sohn@sap.com> 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.errors;

  11. /**
  12.  * Thrown when an external command failed
  13.  *
  14.  * @since 4.5
  15.  */
  16. public class CommandFailedException extends Exception {

  17.     private static final long serialVersionUID = 1L;

  18.     private int returnCode;

  19.     /**
  20.      * Constructor for CommandFailedException
  21.      *
  22.      * @param returnCode
  23.      *            return code returned by the command
  24.      * @param message
  25.      *            error message
  26.      */
  27.     public CommandFailedException(int returnCode, String message) {
  28.         super(message);
  29.         this.returnCode = returnCode;
  30.     }

  31.     /**
  32.      * Constructor for CommandFailedException
  33.      *
  34.      * @param returnCode
  35.      *            return code returned by the command
  36.      * @param message
  37.      *            error message
  38.      * @param cause
  39.      *            exception causing this exception
  40.      */
  41.     public CommandFailedException(int returnCode, String message,
  42.             Throwable cause) {
  43.         super(message, cause);
  44.         this.returnCode = returnCode;
  45.     }

  46.     /**
  47.      * Get return code returned by the command
  48.      *
  49.      * @return return code returned by the command
  50.      */
  51.     public int getReturnCode() {
  52.         return returnCode;
  53.     }
  54. }