-- debussy007 <[EMAIL PROTECTED]> wrote
(on Saturday, 15 September 2007, 03:31 AM -0700):
> 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.

The above isn't an exception -- it's a PHP warning. You can easily turn
those off in your bootstrap with the following:

    ini_set('display_errors', false);

which is something you want to do in your production code anyways.

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to