MDL-16405 - throw the right exception during admin operations to avoid unnecessary...
authormjollnir_ <mjollnir_>
Tue, 9 Sep 2008 13:44:16 +0000 (13:44 +0000)
committermjollnir_ <mjollnir_>
Tue, 9 Sep 2008 13:44:16 +0000 (13:44 +0000)
lib/portfolio/plugin.php

index 297d7bc7a1aa6ae86a92a7c9e6ebc109ee6431be..154eaf7588759963c26e27edc4fefc28f46c7d47 100644 (file)
@@ -644,7 +644,10 @@ abstract class portfolio_plugin_base {
             return true;
         }
         $a = (object)array('property' => $field, 'class' => get_class($this));
-        throw new portfolio_export_exception($this->get('exporter'), 'invalidproperty', 'portfolio', null, $a);
+        if ($this->get('exporter')) {
+            throw new portfolio_export_exception($this->get('exporter'), 'invalidproperty', 'portfolio', null, $a);
+        }
+        throw new portfolio_exception('invalidproperty', 'portfolio', null, $a); // this happens outside export (eg admin settings)
 
     }