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

[PATCH] git-remote-mediawiki: better error message when HTTP(S) access fails

From
Matthieu Moy <matthieu.moy@imag.fr>
Date
May 23, 2013, 20:05 UTC
Message-ID
<1369339503-12426-1-git-send-email-Matthieu.Moy@imag.fr>

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
Next: Jeff King
Message 1 of 6 in “git-remote-mediawiki: better error message when HTTP(S) access fails”
  1. git-remote-mediawiki: better error message when HTTP(S) access failsMatthieu Moy, May 23, 2013
  2. Jeff KingMay 28, 2013
  3. Matthieu MoyMay 29, 2013
  4. git-remote-mediawiki: better error message when HTTP(S) access failsMatthieu Moy, May 29, 2013
  5. Jeff KingMay 29, 2013
  6. Jeff KingMay 29, 2013

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.