library/SDIS62/Rest/Server.php
public function fault($exception = null, $code = null)
    {
        // Copié collé de Zend_Server_Rest::fault() ...
        if (isset($this->_functions[$this->_method]))
        {
            $function = $this->_functions[$this->_method];
        }
        elseif (isset($this->_method))
        {
            $function = $this->_method;
        }
        else
        {
            $function = 'rest';
        }

        if ($function instanceof Zend_Server_Reflection_Method)
        {
            $class = $function->getDeclaringClass()->getName();
        }
        else
        {
            $class = false;
        }

        if ($function instanceof Zend_Server_Reflection_Function_Abstract)
        {
            $method = $function->getName();
        }
        else
        {
            $method = $function;
        }

        // Message et code d'erreur
        $exception_message = null;
        $code_message = null;
        
        if($exception instanceof Exception)
        {
            $code_message = $exception->getCode();
            $exception_message = $exception->getMessage();
        }
        elseif(($exception !== null) || 'rest' == $function)
        {
            $exception_message = 'An unknown error occured. Please try again.';
        }
        else
        {
            $exception_message = 'Call to ' . $method . ' failed.';
        }

        // Headers to send
        if ($code_message === null || (404 != $code_message))
        {
            $this->_headers[] = 'HTTP/1.0 400 Bad Request';
        }
        else
        {
            $this->_headers[] = 'HTTP/1.0 404 File Not Found';
        }
        
        // On envoie le message d'erreur
        return $exception_message;
    }
public function fault($exception = null, $code = null)
    {
        // Copié collé de Zend_Server_Rest::fault() ...
        if (isset($this->_functions[$this->_method]))
        {
            $function = $this->_functions[$this->_method];
        }
        elseif (isset($this->_method))
        {
            $function = $this->_method;
        }
        else
        {
            $function = 'rest';
        }

        if ($function instanceof Zend_Server_Reflection_Method)
        {
            $class = $function->getDeclaringClass()->getName();
        }
        else
        {
            $class = false;
        }

        if ($function instanceof Zend_Server_Reflection_Function_Abstract)
        {
            $method = $function->getName();
        }
        else
        {
            $method = $function;
        }

        // Message et code d'erreur
        $exception_message = null;
        $code_message = null;
        
        if($exception instanceof Exception)
        {
            $code_message = $exception->getCode();
            $exception_message = $exception->getMessage();
        }
        elseif(($exception !== null) || 'rest' == $function)
        {
            $exception_message = 'An unknown error occured. Please try again.';
        }
        else
        {
            $exception_message = 'Call to ' . $method . ' failed.';
        }

        // Headers to send
        if ($code_message === null || (404 != $code_message))
        {
            $this->_headers[] = 'HTTP/1.0 400 Bad Request';
        }
        else
        {
            $this->_headers[] = 'HTTP/1.0 404 File Not Found';
        }
        
        // On envoie le message d'erreur
        return $exception_message;
    }
public function fault ( $ exception = null , $ code = null ) { // Copié collé de Zend_Server_Rest::fault() ... if ( isset ( $ this -> _functions [ $ this -> _method ] ) ) { $ function = $ this -> _functions [ $ this -> _method ] ; } elseif ( isset ( $ this -> _method ) ) { $ function = $ this -> _method ; } else { $ function = 'rest' ; } if ( $ function instanceof Zend_Server_Reflection_Method ) { $ class = $ function -> getDeclaringClass ( ) -> getName ( ) ; } else { $ class = false ; } if ( $ function instanceof Zend_Server_Reflection_Function_Abstract ) { $ method = $ function -> getName ( ) ; } else { $ method = $ function ; } // Message et code d'erreur $ exception_message = null ; $ code_message = null ; if ( $ exception instanceof Exception ) { $ code_message = $ exception -> getCode ( ) ; $ exception_message = $ exception -> getMessage ( ) ; } elseif ( ( $ exception !== null ) || 'rest' == $ function ) { $ exception_message = 'An unknown error occured. Please try again.' ; } else { $ exception_message = 'Call to ' . $ method . ' failed.' ; } // Headers to send if ( $ code_message === null || ( 404 != $ code_message ) ) { $ this -> _headers [ ] = 'HTTP/1.0 400 Bad Request' ; } else { $ this -> _headers [ ] = 'HTTP/1.0 404 File Not Found' ; } // On envoie le message d'erreur return $ exception_message ; }
Implement Zend_Server_Interface::fault()

Creates XML error response, returning DOMDocument with response.

@param string|Exception $fault Message
@param int $code Error Code
@return DOMDocument
Implement Zend_Server_Interface :: fault ()