From 98e0c85937f818c271e30128474709292abeed5b Mon Sep 17 00:00:00 2001 From: Saophalkun Ponlu Date: Tue, 24 Feb 2009 00:35:59 +0000 Subject: [PATCH] by pass the exception (error) where there's an error on spamprotecter field --- code/SpamProtecterManager.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) 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;