The problem with this is that you loose the actual exception object.

I would much prefer something along what the front controller does.
Zend_Controller_Front::getInstance()->throwExceptions(true);

Something like this would be handy for example...

$server->throwException(true);
try {
    echo $server->handle();
} catch (MyPersonalException $e) {
    echo $server->fault($e);
} catch (Exception $e) {
    // do other things like logging, email the admin as this was an
unexpected error.
    echo $server->fault(new Exception('An unknown error occured. Please try
again.'));
}

--
/James

On Fri, Apr 11, 2008 at 6:05 PM, Matthew Weier O'Phinney <[EMAIL PROTECTED]>
wrote:

> -- James Dempster <[EMAIL PROTECTED]> wrote
> (on Friday, 11 April 2008, 04:33 PM +0100):
> > I have the very same problem.
> >
> > I'd much prefer to catch the Exceptions myself, and deal with them by
> either
> > allowing the message though based on the type of Exception, or change it
> to a
> > generic Exception.
> >
> > Maybe time to submit an issue regarding this?
>
> Actually, you can capture the response, and test to see if it is a fault
> response, and then modify it before sending:
>
> $response = $server->handle();
>
> if ($response instanceof Zend_XmlRpc_Server_Fault) {
>    // handle differently
> } else {
>    echo $response;
> }
>
>
> > On Fri, Apr 11, 2008 at 3:28 PM, Peter Boehlke <[EMAIL PROTECTED]>
> wrote:
> >
> >
> >     Hi there,
> >
> >     i'm trying around with the Zend_XMLRPC-Server. So far, i'm very
> pleased
> >     with
> >     it. Everything runs without Problems etc.
> >
> >     But i have one Problem concerning the Zend_XmlRpc_Server_Fault
> >     (standard)messages. I want to respond with my own fault-XML-grids,
> if
> >     something in the Request was wrong.
> >
> >     Furthermore, i want to validate the Request by myself and generate
> more
> >     exact error-messages in the fault-message;
> >
> >     I hope this is understandable! ;)
> >     Thank you in advance,
> >
> >     Peter Boehlke
> >     --
> >     View this message in context: http://www.nabble.com/
> >
> Zend_XMLRPC_Server-overwrite--response-customized-Fault-Msgs.-tp16627837p16627837.html
> >     Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> >
> >
>
> --
> Matthew Weier O'Phinney
> Software Architect       | [EMAIL PROTECTED]
> Zend - The PHP Company   | http://www.zend.com/
>

Reply via email to