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 /**
13 * Thrown when an external command failed
14 *
15 * @since 4.5
16 */
17 public class CommandFailedException extends Exception {
18
19 private static final long serialVersionUID = 1L;
20
21 private int returnCode;
22
23 /**
24 * Constructor for CommandFailedException
25 *
26 * @param returnCode
27 * return code returned by the command
28 * @param message
29 * error message
30 */
31 public CommandFailedException(int returnCode, String message) {
32 super(message);
33 this.returnCode = returnCode;
34 }
35
36 /**
37 * Constructor for CommandFailedException
38 *
39 * @param returnCode
40 * return code returned by the command
41 * @param message
42 * error message
43 * @param cause
44 * exception causing this exception
45 */
46 public CommandFailedException(int returnCode, String message,
47 Throwable cause) {
48 super(message, cause);
49 this.returnCode = returnCode;
50 }
51
52 /**
53 * Get return code returned by the command
54 *
55 * @return return code returned by the command
56 */
57 public int getReturnCode() {
58 return returnCode;
59 }
60 }