]> git.wh0rd.org Git - tt-rss.git/commitdiff
pluginhandler: better error reporting
authorAndrew Dolgov <fox@fakecake.org>
Sat, 16 Mar 2013 08:26:14 +0000 (12:26 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Sat, 16 Mar 2013 08:26:14 +0000 (12:26 +0400)
classes/pluginhandler.php

index df7058dcd6d4f78241617e277b7aa481b262dd7c..eb859ab323ce26d920b8af025070ce1be5947704 100644 (file)
@@ -9,8 +9,14 @@ class PluginHandler extends Handler_Protected {
 
                $plugin = $pluginhost->get_plugin($_REQUEST["plugin"]);
 
-               if (method_exists($plugin, $method)) {
-                       $plugin->$method();
+               if ($plugin) {
+                       if (method_exists($plugin, $method)) {
+                               $plugin->$method();
+                       } else {
+                               print json_encode(array("error" => "METHOD_NOT_FOUND"));
+                       }
+               } else {
+                       print json_encode(array("error" => "PLUGIN_NOT_FOUND"));
                }
        }
 }