protected function returnFailure(Exception $exception, $withMessage=true)
    {
        $data = array();
        if ($withMessage) {
            $data['success'] = false;
            $data['errorCode'] = 500;
            $data['version'] = TAO_VERSION;
            if ($exception instanceof common_exception_UserReadableException) {
                $data['errorMsg'] = $exception->getUserMessage();
            } else {
                $this->logWarning(__CLASS__ . ' : ' . $exception->getMessage());
                $data['errorMsg'] = __('Unexpected error. Please contact administrator');
            }
        }

        $this->returnJson($data, 500);
        exit(0);
    }
protected function returnFailure(Exception $exception, $withMessage=true)
    {
        $data = array();
        if ($withMessage) {
            $data['success'] = false;
            $data['errorCode'] = 500;
            $data['version'] = TAO_VERSION;
            if ($exception instanceof common_exception_UserReadableException) {
                $data['errorMsg'] = $exception->getUserMessage();
            } else {
                $this->logWarning(__CLASS__ . ' : ' . $exception->getMessage());
                $data['errorMsg'] = __('Unexpected error. Please contact administrator');
            }
        }

        $this->returnJson($data, 500);
        exit(0);
    }
protected function returnFailure ( Exception $ exception , $ withMessage = true ) { $ data = array ( ) ; if ( $ withMessage ) { $ data [ 'success' ] = false ; $ data [ 'errorCode' ] = 500 ; $ data [ 'version' ] = TAO_VERSION ; if ( $ exception instanceof common_exception_UserReadableException ) { $ data [ 'errorMsg' ] = $ exception -> getUserMessage ( ) ; } else { $ this -> logWarning ( __CLASS__ . ' : ' . $ exception -> getMessage ( ) ) ; $ data [ 'errorMsg' ] = __ ( 'Unexpected error. Please contact administrator' ) ; } } $ this -> returnJson ( $ data , 500 ) ; exit ( 0 ) ; }
Return an error reponse following the given exception
An exception handler manages http code, avoid to use returnJson to add unneeded header

@param Exception $exception
@param bool $withMessage
Return an error reponse following the given exception An exception handler manages http code avoid to use returnJson to add unneeded header