git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH] git-remote-mediawiki: better error message when HTTP(S) access fails
Date: Thu, 23 May 2013 22:05:03 +0200	[thread overview]
Message-ID: <1369339503-12426-1-git-send-email-Matthieu.Moy@imag.fr> (raw)

My use-case is an invalid SSL certificate. Pulling from the wiki with a
recent version of libwww-perl fails, and git-remote-mediawiki gave no
clue about the reason. Give the mediawiki API detailed error message, and
since it is not so informative, hint the user about an invalid SSL
certificate on https:// urls.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
 contrib/mw-to-git/git-remote-mediawiki.perl | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/contrib/mw-to-git/git-remote-mediawiki.perl b/contrib/mw-to-git/git-remote-mediawiki.perl
index 9c14c1f..5b6e833 100755
--- a/contrib/mw-to-git/git-remote-mediawiki.perl
+++ b/contrib/mw-to-git/git-remote-mediawiki.perl
@@ -292,7 +292,13 @@ sub get_mw_all_pages {
 	if (!defined($mw_pages)) {
 		print STDERR "fatal: could not get the list of wiki pages.\n";
 		print STDERR "fatal: '$url' does not appear to be a mediawiki\n";
-		print STDERR "fatal: make sure '$url/api.php' is a valid page.\n";
+		if ($url =~ /^https/) {
+		    print STDERR "fatal: make sure '$url/api.php' is a valid page\n";
+		    print STDERR "fatal: and the SSL certificate is correct.\n";
+		} else {
+		    print STDERR "fatal: make sure '$url/api.php' is a valid page.\n";
+		}
+		print STDERR "error: " . $mediawiki->{error}->{details} . "\n";
 		exit 1;
 	}
 	foreach my $page (@{$mw_pages}) {
-- 
1.8.3.rc3.8.g5e49f30

             reply	other threads:[~2013-05-23 20:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 20:05 Matthieu Moy [this message]
2013-05-28 18:07 ` [PATCH] git-remote-mediawiki: better error message when HTTP(S) access fails Jeff King
2013-05-29 12:01   ` Matthieu Moy
2013-05-29 12:06     ` [PATCH v2] " Matthieu Moy
2013-05-29 15:26       ` Jeff King
2013-05-29 15:22     ` [PATCH] " Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369339503-12426-1-git-send-email-Matthieu.Moy@imag.fr \
    --to=matthieu.moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).