diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-10-16 19:03:33 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-10-16 19:03:33 +0000 |
commit | 7c18261b8051e684b6650ad5d780cf5a07f7f0e7 (patch) | |
tree | f28e4c9422fee30d6358794e6162d43b9372685f /IkiWiki/Plugin | |
parent | b02bbe825352a754736f128afc93466d01504f1a (diff) | |
download | ikiwiki-7c18261b8051e684b6650ad5d780cf5a07f7f0e7.tar ikiwiki-7c18261b8051e684b6650ad5d780cf5a07f7f0e7.tar.gz |
* Wrap entire technortati ping operation in an eval to catch all possible
failure modes, after I observed a simple ->value crashing ikiwiki when
a ping failed.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 1ee79180c..c02aac1ce 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -314,17 +314,22 @@ sub pingurl (@) { #{{{ my $title=pagetitle(basename($page)); my $url="$config{url}/".htmlpage($page); foreach my $pingurl (@{$config{pingurl}}) { - my $client = RPC::XML::Client->new($pingurl); - my $req = RPC::XML::request->new('weblogUpdates.ping', - $title, $url); debug("Pinging $pingurl for $page"); - my $res = $client->send_request($req); - if (! ref $res) { - debug("Did not receive response to ping"); - } - my $r=$res->value; - if (! exists $r->{flerror} || $r->{flerror}) { - debug("Ping rejected: ".(exists $r->{message} ? $r->{message} : "[unknown reason]")); + eval { + my $client = RPC::XML::Client->new($pingurl); + my $req = RPC::XML::request->new('weblogUpdates.ping', + $title, $url); + my $res = $client->send_request($req); + if (! ref $res) { + debug("Did not receive response to ping"); + } + my $r=$res->value; + if (! exists $r->{flerror} || $r->{flerror}) { + debug("Ping rejected: ".(exists $r->{message} ? $r->{message} : "[unknown reason]")); + } + }; + if ($@) { + debug "Ping failed: $@"; } } } |