git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[EGIT PATCH 2/3] Handle NoRemoteRepositoryException in PushOperation especially

From
MZMarek Zawirski <marek.zawirski@gmail.com>
Date
Aug 28, 2008, 01:36 UTC
Message-ID
<1219887370-17265-2-git-send-email-marek.zawirski@gmail.com>
In-Reply-To
<1219887370-17265-1-git-send-email-marek.zawirski@gmail.com>

We can give user better feedback for this special case, as it is common and not directly related to protocol error.

Reported-by: Robert <robert_no.spam_m@yahoo.fr>
Signed-off-by: Marek Zawirski <marek.zawirski@gmail.com>
---

Beside of this change, we may consider removing URI part of TransportException from message, moving it to the field and providing API for getting this URI. That may allow us showing user cleaner messages.

 .../src/org/spearce/egit/core/CoreText.java        |    3 +++
 .../src/org/spearce/egit/core/coretext.properties  |    1 +
 .../org/spearce/egit/core/op/PushOperation.java    |    5 +++++
 3 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java b/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
index 35e17b9..a750117 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/CoreText.java
@@ -108,6 +108,9 @@
 	public static String PushOperation_resultTransportError;
 
 	/** */
+	public static String PushOperation_resultNoServiceError;
+
+	/** */
 	public static String PushOperation_taskNameDryRun;
 
 	/** */
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/coretext.properties b/org.spearce.egit.core/src/org/spearce/egit/core/coretext.properties
index 94cf4aa..04ca28f 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/coretext.properties
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/coretext.properties
@@ -61,5 +61,6 @@ ListRemoteOperation_title=Getting remote branches information
 PushOperation_resultCancelled=Operation was cancelled.
 PushOperation_resultNotSupported=Can't push to {0}
 PushOperation_resultTransportError=Transport error occured during push operation: {0}
+PushOperation_resultNoServiceError=Push service is not available: {0}
 PushOperation_taskNameDryRun=Trying pushing to remote repositories
 PushOperation_taskNameNormalRun=Pushing to remote repositories
diff --git a/org.spearce.egit.core/src/org/spearce/egit/core/op/PushOperation.java b/org.spearce.egit.core/src/org/spearce/egit/core/op/PushOperation.java
index 8811800..a0f2e5c 100644
--- a/org.spearce.egit.core/src/org/spearce/egit/core/op/PushOperation.java
+++ b/org.spearce.egit.core/src/org/spearce/egit/core/op/PushOperation.java
@@ -16,6 +16,7 @@
 import org.eclipse.osgi.util.NLS;
 import org.spearce.egit.core.CoreText;
 import org.spearce.egit.core.EclipseGitProgressTransformer;
+import org.spearce.jgit.errors.NoRemoteRepositoryException;
 import org.spearce.jgit.errors.NotSupportedException;
 import org.spearce.jgit.errors.TransportException;
 import org.spearce.jgit.lib.Repository;
@@ -125,6 +126,10 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException {
 				final PushResult pr = transport.push(gitSubMonitor,
 						specification.getRefUpdates(uri));
 				operationResult.addOperationResult(uri, pr);
+			} catch (final NoRemoteRepositoryException e) {
+				operationResult.addOperationResult(uri, NLS.bind(
+						CoreText.PushOperation_resultNoServiceError, e
+								.getMessage()));
 			} catch (final TransportException e) {
 				operationResult.addOperationResult(uri, NLS.bind(
 						CoreText.PushOperation_resultTransportError, e
-- 
1.5.6.3
Previous: Marek ZawirskiNext: Marek Zawirski
Message 2 of 10 in “Give NoRemoteRepositoryException better message in BasePackConnection”
  1. 1/3 Give NoRemoteRepositoryException better message in BasePackConnectionMarek Zawirski, Aug 28, 2008
  2. 2/3 Handle NoRemoteRepositoryException in PushOperation especiallyMarek Zawirski, Aug 28, 2008
  3. 3/3 Show ErrorDialog fot fatal connection errors in ConfirmationPageMarek Zawirski, Aug 28, 2008
  4. Shawn O. PearceAug 28, 2008
  5. Marek ZawirskiAug 28, 2008
  6. Shawn O. PearceAug 28, 2008
  7. Marek ZawirskiAug 28, 2008
  8. Shawn O. PearceAug 28, 2008
  9. Marek ZawirskiAug 28, 2008
  10. Shawn O. PearceAug 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.