diff --git a/code/SpamProtecterManager.php b/code/SpamProtecterManager.php index 49d5988..9338b1b 100644 --- a/code/SpamProtecterManager.php +++ b/code/SpamProtecterManager.php @@ -27,14 +27,23 @@ class SpamProtecterManager { * and a string of field names (seperated by comma) as a value. * The naming of the fields is based on the implementation of the subclass of SpamProtecterField. * *** Most of the web service doesn't require this. - * @return SpamProtector object or return null if the spamprotecter class is not found - * or spamprotecterfield creation fails. + * @return SpamProtector object on success or null if the spamprotecter class is not found + * also null if spamprotecterfield creation fails. */ static function update_form($form, $before=null, $callbackObject=null, $fieldsToSpamServiceMapping=null) { if (!class_exists(self::$spam_protecter)) return null; $protecter = new self::$spam_protecter(); - $check = $protecter->updateForm($form, $before, $callbackObject, $fieldsToSpamServiceMapping); + try { + $check = $protecter->updateForm($form, $before, $callbackObject, $fieldsToSpamServiceMapping); + } + catch (Exception $e) { + $form->setMessage( + _t("SpamProtection.SPAMSPECTIONFAILED", self::$spam_protecter . " failed."), + "warning" + ); + return null; + } if (!$check) return null;