* external: Fix support of XML::RPC::fault.

master
Joey Hess 2008-03-15 13:49:22 -04:00
parent b8c55c4db2
commit e7ce86db11
3 changed files with 12 additions and 5 deletions

View File

@ -59,15 +59,17 @@ sub rpc_call ($$;@) { #{{{
error("XML RPC parser failure: $r") unless ref $r; error("XML RPC parser failure: $r") unless ref $r;
if ($r->isa('RPC::XML::response')) { if ($r->isa('RPC::XML::response')) {
my $value=$r->value; 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}; return @{$value->value};
} }
elsif ($value->isa('RPC::XML::struct')) { elsif ($value->isa('RPC::XML::struct')) {
return %{$value->value}; return %{$value->value};
} }
elsif ($value->isa('RPC::XML::fault')) {
die $value->string;
}
else { else {
return $value->value; return $value->value;
} }
@ -177,7 +179,8 @@ sub hook ($@) { #{{{
delete $params{call}; delete $params{call};
IkiWiki::hook(%params, call => sub { IkiWiki::hook(%params, call => sub {
IkiWiki::Plugin::external::rpc_call($plugin, $callback, @_) my $ret=IkiWiki::Plugin::external::rpc_call($plugin, $callback, @_);
return $ret;
}); });
} #}}} } #}}}

1
debian/changelog vendored
View File

@ -40,6 +40,7 @@ ikiwiki (2.41) UNRELEASED; urgency=low
Closes: #470530 Closes: #470530
* Fix expiry of old recentchanges changeset pages. * Fix expiry of old recentchanges changeset pages.
* French translation update. Closes: #471010 * French translation update. Closes: #471010
* external: Fix support of XML::RPC::fault.
-- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100 -- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100

View File

@ -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. 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]] --[[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]]