From: Joey Hess Date: Sat, 15 Mar 2008 17:49:22 +0000 (-0400) Subject: * external: Fix support of XML::RPC::fault. X-Git-Tag: 2.41~112 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/e7ce86db11174606d06a6cfabfa9c41aa3cbd50e?ds=inline;hp=b8c55c4db282c87e3bada4491329ac3c940ff28d * external: Fix support of XML::RPC::fault. --- diff --git a/IkiWiki/Plugin/external.pm b/IkiWiki/Plugin/external.pm index a5afdc4be..2650a8cd1 100644 --- a/IkiWiki/Plugin/external.pm +++ b/IkiWiki/Plugin/external.pm @@ -59,15 +59,17 @@ sub rpc_call ($$;@) { #{{{ error("XML RPC parser failure: $r") unless ref $r; if ($r->isa('RPC::XML::response')) { my $value=$r->value; - if ($value->isa('RPC::XML::array')) { + if ($r->is_fault($value)) { + # throw the error as best we can + print STDERR $value->string."\n"; + return ""; + } + elsif ($value->isa('RPC::XML::array')) { return @{$value->value}; } elsif ($value->isa('RPC::XML::struct')) { return %{$value->value}; } - elsif ($value->isa('RPC::XML::fault')) { - die $value->string; - } else { return $value->value; } @@ -177,7 +179,8 @@ sub hook ($@) { #{{{ delete $params{call}; IkiWiki::hook(%params, call => sub { - IkiWiki::Plugin::external::rpc_call($plugin, $callback, @_) + my $ret=IkiWiki::Plugin::external::rpc_call($plugin, $callback, @_); + return $ret; }); } #}}} diff --git a/debian/changelog b/debian/changelog index b9bfd363d..85db048e8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -40,6 +40,7 @@ ikiwiki (2.41) UNRELEASED; urgency=low Closes: #470530 * Fix expiry of old recentchanges changeset pages. * French translation update. Closes: #471010 + * external: Fix support of XML::RPC::fault. -- martin f. krafft Sun, 02 Mar 2008 17:46:38 +0100 diff --git a/doc/bugs/ikiwiki_renders___39__28__39___if_external_plugins_return_nothing.mdwn b/doc/bugs/ikiwiki_renders___39__28__39___if_external_plugins_return_nothing.mdwn index b22c44e16..8d73dfa86 100644 --- a/doc/bugs/ikiwiki_renders___39__28__39___if_external_plugins_return_nothing.mdwn +++ b/doc/bugs/ikiwiki_renders___39__28__39___if_external_plugins_return_nothing.mdwn @@ -7,3 +7,6 @@ If the rst2html procedure of the rst external plugin returns None (e.g. when it In addition to the broken plugin, this seems like a bug in ikiwiki, which should probably output an informational message about the plugin returning an invalid value. --[[madduck]] + +> [[done]], I made it print the thrown error message to stderr, and return +> "", which seems better than dying of the thrown error entirely. --[[Joey]]