TransportException.java

  1. /*
  2.  * Copyright (C) 2008, Marek Zawirski <marek.zawirski@gmail.com>
  3.  * Copyright (C) 2007, Robin Rosenberg <robin.rosenberg@dewire.com>
  4.  * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org> and others
  5.  *
  6.  * This program and the accompanying materials are made available under the
  7.  * terms of the Eclipse Distribution License v. 1.0 which is available at
  8.  * https://www.eclipse.org/org/documents/edl-v10.php.
  9.  *
  10.  * SPDX-License-Identifier: BSD-3-Clause
  11.  */

  12. package org.eclipse.jgit.errors;

  13. import java.io.IOException;

  14. import org.eclipse.jgit.transport.URIish;

  15. /**
  16.  * Indicates a protocol error has occurred while fetching/pushing objects.
  17.  */
  18. public class TransportException extends IOException {
  19.     private static final long serialVersionUID = 1L;

  20.     /**
  21.      * Constructs an TransportException with the specified detail message
  22.      * prefixed with provided URI.
  23.      *
  24.      * @param uri
  25.      *            URI used for transport
  26.      * @param s
  27.      *            message
  28.      */
  29.     public TransportException(URIish uri, String s) {
  30.         super(uri.setPass(null) + ": " + s); //$NON-NLS-1$
  31.     }

  32.     /**
  33.      * Constructs an TransportException with the specified detail message
  34.      * prefixed with provided URI.
  35.      *
  36.      * @param uri
  37.      *            URI used for transport
  38.      * @param s
  39.      *            message
  40.      * @param cause
  41.      *            root cause exception
  42.      */
  43.     public TransportException(final URIish uri, final String s,
  44.             final Throwable cause) {
  45.         this(uri.setPass(null) + ": " + s, cause); //$NON-NLS-1$
  46.     }

  47.     /**
  48.      * Constructs an TransportException with the specified detail message.
  49.      *
  50.      * @param s
  51.      *            message
  52.      */
  53.     public TransportException(String s) {
  54.         super(s);
  55.     }

  56.     /**
  57.      * Constructs an TransportException with the specified detail message.
  58.      *
  59.      * @param s
  60.      *            message
  61.      * @param cause
  62.      *            root cause exception
  63.      */
  64.     public TransportException(String s, Throwable cause) {
  65.         super(s);
  66.         initCause(cause);
  67.     }
  68. }