/**
  * Creates and returns a new Exception instance.
  *
  * @param string $message The message itself
  * @param string $key The key for I18N
  * @return Faett_Channel_Exceptions_ChannelNotActivatedException
  */
 public static function create($message, $key = '')
 {
     // create a new message
     $e = new Faett_Channel_Exceptions_ChannelNotActivatedException($message);
     // set the message key
     $e->_setKey($key);
     // return the message
     return $e;
 }
 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     try {
         // call the parents class method
         parent::preDispatch();
         // load the channel
         $channel = Mage::getModel('channel/channel')->load(Mage::app()->getStore()->getId());
         // check if the channel is activated
         if (!$channel->isChannel()) {
             throw Faett_Channel_Exceptions_ChannelNotActivatedException::create('The store is not activated as channel', '200.error.channel-not-activated');
         }
         // resolve the needed parameters from the requested resource name
         $this->_params = Mage::helper('channel')->resolve($this->getRequest()->getRequestString());
         // return the instance itself
         return $this;
     } catch (Faett_Channel_Exceptions_ChannelNotActivatedException $cnae) {
         // log the exception
         Mage::logException($cnae);
         // if not, foward to the default 404 page
         $this->_forward('noRoute', 'default');
     } catch (Faett_Channel_Exceptions_ResourceNotFoundException $rnfe) {
         // log the exception
         Mage::logException($rnfe);
         // register the error message
         Mage::register(Faett_Channel_Block_NotFound::MESSAGE, $this->_getHelper()->__($rnfe->getKey()));
         // forward to the not found page
         $this->_forward('notFound', 'error', 'channel');
     } catch (Exception $e) {
         // log the exception
         Mage::logException($e);
         // register the error message
         Mage::register(Faett_Channel_Block_InternalServerError::MESSAGE, $e->getMessage());
         // forward to the internal server error page
         $this->_forward('internalServerError', 'error', 'channel');
     }
 }