Output error message

@return PageXml
429709
public function CreatePage()
	{
		$this->_myWords = $this->WordCollection();

		$title = $this->_myWords->Value("TITLE", $this->_context->get("SERVER_NAME") );
		$abstract = $this->_myWords->Value("ABSTRACT", $this->_context->get("SERVER_NAME") );
		$document = new XmlnukeDocument($title, $abstract);
		
		$this->_url = "module:UserProfile";
				
		$this->_users = $this->getUsersDatabase();
		
		$this->_user = $this->_users->getUserName( $this->_context->authenticatedUser() );
		
		$blockCenterTitle = $this->_myWords->ValueArgs("TITLE", array ($this->_user->getField($this->_users->getUserTable()->username)));
		$blockcenter = new XmlBlockCollection($blockCenterTitle, BlockPosition::Center );
		$document->addXmlnukeObject($blockcenter);
		
		$this->_paragraph = new XmlParagraphCollection();
		$blockcenter->addXmlnukeObject($this->_paragraph);

		$action = $this->_context->get("action");

		switch ($action)
		{
			case "update":
				$this->update();
				break;
			case "changepassword":
				$this->changePWD();
				break;				
		}		
		
		$this->formUserInfo();
		
		$this->formPasswordInfo();
		
		$this->formRolesInfo();	

		return $document->generatePage();
	}
280918
function Render()
    {
        self::$currentPage = $this->page;
        self::$Title = self::$currentPage->GetTitle();
        self::$Description = self::$currentPage->GetDescription();
        self::$Keywords = self::$currentPage->GetKeywords();
        if ($this->page->GetType() == (string)PageType::NotFound())
        {
            header('HTTP/1.0 404 Not Found');
        }
        else if ($this->page->GetType() !== (string)PageType::Normal())
        {
            throw new \Exception('Internal phine error: not normal page called');
        }
        ob_start();
        require PathUtil::LayoutTemplate($this->layout);
        $result = ob_get_clean();
        $replacer = new Replacer();
        return $replacer->RealizeVariables($result);
    }
1340575
public function getErrorMessage()
    {
        $errorMessage = '';

        $dom = $this->getDOMDocument();
        $xpath = new DOMXPath($dom);
        if (($errorNode = $xpath->query('/response/error')->item(0)) instanceof DOMNode) {
            $errorMessage = $errorNode->nodeValue;
        }

        return $errorMessage;
    }
195230
protected function showXML($exception) {
		$endline = "\r\n";
		$xml = '<?xml version="1.0" encoding="UTF-8"?>'.$endline.
				'<response>'.$endline.
					'<status>error</status>'.$endline.
					'<message>'.htmlspecialchars($this->getMessageForUser($exception)).'</message>'.$endline.
				'</response>';

		header('Content-Type: application/xml; charset=utf-8');
		echo $xml;
	}
849979
private function insertErrorMessages() {

		$rex = '/\{(?:\w+\|)*error_%s(?:\|\w+)*:([^\}]+)\}/i';

		foreach($this->formErrors as $name => $v) {
			if(!is_array($v)) {
				$this->html = preg_replace(
					sprintf($rex, $name),
					'$1',
					$this->html
				);
			}
			else {
				foreach(array_keys($this->formErrors[$name]) as $ndx) {
					$this->html = preg_replace(
						sprintf($rex, $name),
						empty($this->formErrors[$name][$ndx]) ? '' : '$1',
						$this->html,
						1
					);
				}
			}
		}
		
		return $this;

	}
525375
public function seeResponseIsXml()
    {
        libxml_use_internal_errors(true);
        $doc = simplexml_load_string($this->connectionModule->_getResponseContent());
        $num = "";
        $title = "";
        if ($doc === false) {
            $error = libxml_get_last_error();
            $num = $error->code;
            $title = trim($error->message);
            libxml_clear_errors();
        }
        libxml_use_internal_errors(false);
        \PHPUnit\Framework\Assert::assertNotSame(
            false,
            $doc,
            "xml decoding error #$num with message \"$title\", see http://www.xmlsoft.org/html/libxml-xmlerror.html"
        );
    }
1266982
public function getHtmlOutput() {
    try {
      $profileId = $this->getFirstProfileId();
      if (isset($profileId)) {
        $results = $this->queryCoreReportingApi($profileId);
        return $this->getFormattedResults($results);
      }

    } catch (Google_ServiceException $e) {
      // Error from the API.
      $this->error = $e->getMessage();

    } catch (demoException $e) {
      // Error running this demo.
      $this->error = $e->getMessage();
    }
    return '';
  }
984986
public function getOuterXml()
	{
		if ( is_null( $this->domNode ) ) return "";
		return is_null( $this->domNode->parentNode )
			? $this->domNode->ownerDocument->saveXml( $this->domNode )
			: $this->domNode->ownerDocument->saveXml( $this->domNode->parentNode );
	}
407863
public function errorAction()
    {
        $errors       = $this->_getParam('error_handler');
        $exception    = $errors->exception;
        $info         = null;
        $message      = 'Application error';
        $responseCode = 200;

        switch ($errors->type) {
            case \Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
            case \Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                // 404 error -- controller or action not found
                $responseCode = 404;
                $message      = 'Page not found';
                break;

            case \Zend_Controller_Plugin_ErrorHandler::EXCEPTION_OTHER:

                if ($exception instanceof \Gems_Exception) {
                    $responseCode = $exception->getCode();
                    $message      = $exception->getMessage();
                    $info         = $exception->getInfo();
                    break;
                }
                // Intentional fall through

            default:
                $message = $exception->getMessage();
                break;
        }

        \Gems_Log::getLogger()->logError($errors->exception, $errors->request);

        if (\MUtil_Console::isConsole()) {
            $this->_helper->viewRenderer->setNoRender(true);

            echo $message . "\n\n";
            if ($info) {
                echo $info . "\n\n";
            }

            $next = $exception->getPrevious();
            while ($next) {
                echo '  ' . $next->getMessage() . "\n";
                $next = $next->getPrevious();
            }

            echo $exception->getTraceAsString();

        } else {
            if ($responseCode) {
                $this->getResponse()->setHttpResponseCode($responseCode);
            }

            $this->view->exception = $exception;
            $this->view->message   = $message;
            $this->view->request   = $errors->request;
            if ($info) {
                $this->view->info = $info;
            }

        }
    }
224634
public function toXML()
    {
        $dom = new DOMDocument( '1.0', 'utf-8' );
        $dom->formatOutput = true;
        $success = $dom->loadXML('<page />');

        $pageNode = $dom->documentElement;

        foreach ( $this->attributes as $attrName => $attrValue )
        {
            switch ( $attrName )
            {
                case 'id':
                    $pageNode->setAttribute( 'id', $attrValue );
                    break;

                case 'zones':
                    foreach ( $this->attributes['zones'] as $zone )
                    {
                        $zoneNode = $zone->toXML( $dom );
                        $pageNode->appendChild( $zoneNode );
                    }
                    break;

                default:
                    $node = $dom->createElement( $attrName );
                    $nodeValue = $dom->createTextNode( $attrValue );
                    $node->appendChild( $nodeValue );
                    $pageNode->appendChild( $node );
                    break;
            }
        }

        return $dom->saveXML();
    }
529661
protected function _formatErrors(array $libxmlErrors=array())
	{
		return 'XSD validation failed with following messages:' . PHP_EOL . implode('', array_map(
			function (\libXMLError $xmlError) {
				return sprintf(
					'[%s:%d] %s',
					$xmlError->file,
					$xmlError->line,
					$xmlError->message
				);
			},
			$libxmlErrors
		));
	}
222166
public function errorMessage()
	{
		if ($this->decoded() === null) {
			throw new \RuntimeException('No result from server.');
		}

		$decoded = $this->decoded();
		if (isset($decoded->error))
			return sprintf('%s (%s)', $decoded->error->message, $decoded->error->code);

		$message = sprintf('%s (%s)', $decoded->message, $this->statusCode());

		if (isset($this->decoded()->errors)) {
			$errors = $this->decoded()->errors;

			$message .= $this->resolveAttributes($errors);
		}

		return $message;
	}
386674
public function canEditPagesAction()
    {
        $melisCoreAuth = $this->getServiceLocator()->get('MelisCoreAuth');
        $xmlRights = $melisCoreAuth->getAuthRights();
    	$rightsObj = simplexml_load_string($xmlRights);
        $sectionId = MelisCmsRightsService::MELISCMS_PREFIX_PAGES;
        if (empty($rightsObj->$sectionId->id))
            $edit = 0;
        else 
            $edit = 1;
            
        $result = array(
            'success' => 1,
            'edit' => $edit
        );
         
        return new JsonModel($result);
    }
1001858
protected function generateMsgHtml()
    {
        $templateIdent = $this->templateIdent();

        if (!$templateIdent) {
            $message = '';
        } else {
            $message = $this->renderTemplate($templateIdent);
        }

        return $message;
    }
117306
public function output()
    {
        // If the view file exists
        if ($this->hasFile()) {
            // Extract all view variables
            extract($this->getVars());
            ob_start();
            include($this->getPath() . '/' . $this->getFile(true));
            $html = ob_get_contents();
            ob_end_clean();
            return $html;
        } else {
            die('Fatal Error: ' . $this->getPath() . '/' . $this->getFile(true) . ' does not exist.');
        }
    }
1135866
public function printMessage() {
		$messages = $_SESSION[$this->sessionKey];
		$html = '';
		
		foreach ($messages as $message){
			$html .='<div id="message" class="' . $message['type'] . '"><p>' . $message['message'] . '</p></div>';
		}
		
		$this->clearSession();
		
		return $html;
	}
1160658
public function xmlOutput() {
        $o = '';
        $o.= '        <FIELD NAME="' . $this->name . '"';
        $o.= ' TYPE="' . $this->getXMLDBTypeName($this->type) . '"';
        if ($this->length) {
            $o.= ' LENGTH="' . $this->length . '"';
        }
        if ($this->notnull) {
            $notnull = 'true';
        } else {
            $notnull = 'false';
        }
        $o.= ' NOTNULL="' . $notnull . '"';
        if (!$this->sequence && $this->default !== null) {
            $o.= ' DEFAULT="' . $this->default . '"';
        }
        if ($this->sequence) {
            $sequence = 'true';
        } else {
            $sequence = 'false';
        }
        $o.= ' SEQUENCE="' . $sequence . '"';
        if ($this->decimals !== null) {
            $o.= ' DECIMALS="' . $this->decimals . '"';
        }
        if ($this->comment) {
            $o.= ' COMMENT="' . htmlspecialchars($this->comment) . '"';
        }
        $o.= '/>' . "\n";

        return $o;
    }