Hello everyone!

I have a question :
Is there any way to remove the exceptions from the response object ?

If you need to know why I ask this read further please :

I am doing an Ajax request for a member registration.
In the action I send him an e-mail (for account activation) with Zend_mail.
And if the e-mail doesn't exist, I catch the exception :
[...]
} catch (Zend_Exception $e2) {
        echo Zend_Json::encode(  
                array(
                        "success" => false, 
                        "msg" => 
                                "Sending activation e-mail failed.<br>Be sure 
your e-mail is valid.<br>"
. 
                                "Feel free to contact " . 
$config->mail->address . 
                                " if you have questions.")
                );
        return;
}
[...]

And as you can see I send back JSon data,
The problem is that if the exceptions remain in the reponse object,
It is not a valid json response because the response would look like plain
text with json together,
like this :
<br />

Warning:  mail() [ function.mail function.mail ]: Failed to connect to
mailserver

 at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and
&quot;smtp_port&quot; setting in

 php.ini or use ini_set() in
D:\websites\mysite\library\Zend\Mail\Transport\Sendmail.php on line 90<br />

{"success":false,"msg":"Sending activation e-mail failed.<br>Be sure your
e-mail is valid.<br>Feel free

 to contact [EMAIL PROTECTED] if you have questions."}

And it does not return in my Javascript.
But if I have no exceptions, which makes it a valid json data, I have it
working.


Thank you for any help !
-- 
View this message in context: 
http://www.nabble.com/best-way-%28if-any%29-to-remove-exceptions-from-response-object-in-controller-tf4447329s16154.html#a12689175
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to