Throwing exceptions from the error handler can be tricky. Make sure
there are no errors in you handler code (not even notices) also
remember that you can not throw an exception from the exception
handler itself (or from the calls it does).

iván

On Mon, Mar 3, 2008 at 6:50 PM, Rick Hopkins <[EMAIL PROTECTED]> wrote:
> I am working on a new MVC based system and have been utilizing PHPTAL
>  for the interface side of things. I am running into a problem though
>  when I try to catch exceptions. I have labeled my new framework
>  "Melodic". I have a static class called "MelodicException" which should
>  catch all the exceptions and process them. I have set_exception_handler
>  so that it will pass everything into MelodicException. So anyway I keep
>  getting the message below in my exception handler.
>
>  Fatal error: Exception thrown without a stack frame in Unknown on line 0
>
>  Here is the exception handler code...
>
>  <?php
>  /**
>   * @name MelodicException
>   * The default exception handling class for the Melodic Framework
>   * @author Rick Hopkins
>   * @package Melodic
>   */
>
>  class MelodicException
>  {
>         /**
>          * Initialize Melodic's customized Exception handler
>          * @param object $_e
>          */
>         static function exception(Exception $_e)
>         {
>                 if (LOG_ERRORS) Core::log(get_class($_e)." Caught. Message:
>  ".$_e->getMessage()." | File: ".$_e->getFile().":".$_e->getLine(), LOG_ERR);
>                 if (NOTIFY_ADMINS) Core::notify(get_class($_e)." Caught", 
> "Message:
>  ".$_e->getMessage()."\nFile:
>  ".$_e->getFile().":".$_e->getLine()."\nTime: ".date("Y-m-d
>  H:i:s")."\n----------\nStackTrace:\n".$_e->getTraceAsString());
>                 if (SHOW_ERRORS){
>                         $_message = "<pre>".$_e->getMessage()."\nFile: 
> ".$_e->getFile()."
>  (Line:".$_e->getLine().")\n----------\nStack
>  Trace:\n".$_e->getTraceAsString()."</pre>";
>                         if (PAGE_ERRORS && TEMPLATE_DIR){
>                                 $_template = new 
> PHPTAL(TEMPLATE_DIR.PAGE_ERRORS);
>                                 $_template->set("TEMPLATE_DIR", TEMPLATE_DIR);
>                                 $_template->set("ERROR_DETAILS", $_message);
>                                 echo $_template->execute();
>                         } else print $_message;
>                 }
>         }
>
>         /**
>          * Handle php errors
>          * @param int $_no
>          * @param string $_str
>          * @param string $_file
>          * @param int $_line
>          */
>         static function error($_no, $_str, $_file, $_line)
>         {
>                 $_types = array(
>                         1 => "E_ERROR",
>                         2 => "E_WARNING",
>                         4 => "E_PARSE",
>                         8 => "E_NOTICE",
>                         16 => "E_CORE_ERROR",
>                         32 => "E_CORE_WARNING",
>                         64 => "E_COMPILE_ERROR",
>                         128 => "E_COMPILE_WARNING",
>                         256 => "E_USER_ERROR",
>                         512 => "E_USER_WARNING",
>                         1024 => "E_USER_NOTICE",
>                         6143 => "E_ALL",
>                         2048 => "E_STRICT",
>                         4096 => "E_RECOVERABLE_ERROR"
>                 );
>                 throw new Exception($_types[$_no]." Caught: ".$_str." in 
> ".$_file." on
>  line ".$_line);
>         }
>  }
>  ?>
>
>  It is dying on the actual execute call. Can't figure out why. Any help
>  would be greatly appreciated.
>
>  --
>  Rick Hopkins
>  616.340.9645
>
>  _______________________________________________
>  PHPTAL mailing list
>  PHPTAL@lists.motion-twin.com
>  http://lists.motion-twin.com/mailman/listinfo/phptal
>

_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to