* external: Fix support of XML::RPC::fault.
authorJoey Hess <joey@kodama.kitenet.net>
Sat, 15 Mar 2008 17:49:22 +0000 (13:49 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Sat, 15 Mar 2008 17:49:22 +0000 (13:49 -0400)
IkiWiki/Plugin/external.pm
debian/changelog
doc/bugs/ikiwiki_renders___39__28__39___if_external_plugins_return_nothing.mdwn

index a5afdc4bef4b28b849b8b25ed414d1f4757f17b8..2650a8cd14e3c31f026ef8d58768e6d997f20ce4 100644 (file)
@@ -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;
        });
 } #}}}
 
index b9bfd363d5cc90d6616a323e6bf08e44fb3f04a4..85db048e839311b8e92e31e94e50e98fffbc38ea 100644 (file)
@@ -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 <madduck@debian.org>  Sun, 02 Mar 2008 17:46:38 +0100
 
index b22c44e1616854c18f582d027f6cc82f872c400f..8d73dfa867bcd44e5bf8d4ebe43774ff3f791f48 100644 (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.
 
 --[[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]]