【发布时间】:2011-04-02 18:22:51
【问题描述】:
我们都同意为不同的任务使用不同的异常类型是可行的方法。
但是,我们最终会创建像这样的幽灵文件:
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Dojo_Exception
*/
require_once 'Zend/Dojo/Exception.php';
/**
* @category Zend
* @package Zend_Dojo
* @subpackage View
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Dojo_View_Exception extends Zend_Dojo_Exception
{
}
那么Zend_Dojo_Exception 和Zend_Exception 相同……
这个问题有什么通用的方法吗?
像throw new \My\Just\Declared\Exception\ (which extends \My\Just\Exception) 这样的东西,所以我不必创建并需要所有这些幽灵文件?
【问题讨论】:
-
这个“行为”会在zf2中重写framework.zend.com/wiki/display/ZFDEV2/…
-
什么行为?从那个链接我看到的只是声明接口的能力?我没有看到任何关于延迟编写异常的信息(类的代码在实例化之前甚至不存在)?我错了,只是误读了链接吗?
-
@robert 这是一个好消息,但并不能解决创建新异常的问题。也许新的 Zend_Autoloader 可以做到这一点。
-
对不起,我刚醒来,误解了这个问题。没关系-_-
-
“我们都同意……”——是吗!? ;-)
标签: php zend-framework exception exception-handling error-handling