I’ve setup a custom error handler controller. This prints out errors in JSON format.
I’ve created a custom Error Handler class like this
class ELanguageException extends CException implements ApiError {
public function __construct($message=null)
{
if ($message==null) {
$message=LANGUAGE_UNKNOWN;
}
parent::__construct($message,404);
}
}
Whenever I have this code on other controller
throw new CHttpException(404, self::LANGUAGE_UNKNOWN);
my custom exception handler does fire, and I get the passed details.
But I have problem when I fire my custom error handler
throw new ELanguageException(self::LANGUAGE_UNKNOWN);
In this case, the Yii’s default error handler fires, and not my custom error handler. What I am doing wrong?