Printing to View during an Exception
Silly question: in my code I collect all the messages to be displayed in the view in a buffer. On the code bellow if my Try{ } fails and go straight to Catch{ } the error will be buffered but the controller wont have the chance to assign to the view, right? How would you guys solve this kind of situation?

    MyController
    {
    //...
    
    try {
      // ... do something
    
      $this->_messages[] = array('success', 'Thank You.');
    }    
    catch (Exception $e) {
      $this->_messages[] = array('error', 'Oops! There was an error.');
    }
    
    /**
     * flush all buffered messages to the view
     */
    $flashmsg = $this->_flashMessenger->getMessages();
    if (!empty($flashmsg)) $this->_messages[] = $flashmsg[0];      
    $this->view->messages = $this->_messages;
    }


Printing to View during an Exception
===

Silly question: in my code I collect all the messages to be displayed in the view in a buffer. On the code bellow if my Try{ } fails and go straight to Catch{ } the error will be buffered but the controller wont have the chance to assign to the view, right? How would you guys solve this kind of situation?

    MyController
    {
    //...
    
    try {
      // ... do something
    
      $this->_messages[] = array('success', 'Thank You.');
    }    
    catch (Exception $e) {
      $this->_messages[] = array('error', 'Oops! There was an error.');
    }
    
    /**
     * flush all buffered messages to the view
     */
    $flashmsg = $this->_flashMessenger->getMessages();
    if (!empty($flashmsg)) $this->_messages[] = $flashmsg[0];      
    $this->view->messages = $this->_messages;
    }

