I'm trygin to migrate my current application to the new CakePHP 2.0
too, and want to create my own custom exceptions. Here is what I did:

//in app/bootstrap.php
App::uses('MissingModelException', 'Lib/Error');

//in app/Lib/Error/MissingModelException.php
class MissingModelException extends CakeException {

        public function __construct($message = null, $code = 500) {
                if (empty($message)) {
                        $message = 'Missing application Model';
                }
                parent::__construct($message, $code);
        }

}

//and in behavior
throw new MissingModelException();

The problem seems to be that __construct of my exception class is not
fired and (in development mode) CakePHP raises warnings for $message
is not been set when calling CakeException::__construct(). That's the
reason to put
parent::__construct($message, $code);
in my exception class constructor.

Any ideas on this


On Oct 13, 9:57 pm, José Lorenzo <[email protected]> wrote:
> My standard is just as Elte Hupkes* *pointed out:
>
> App::uses('MyException', 'Error/Exception'); at the beginning of the class
> that will throw it and put the exception class in app/Lib/Error/Exception
>
> Cheers!

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to