duanfu7840 2011-12-03 20:42
浏览 39
已采纳

Zend_Exception有什么意义?

Why was it necessary to have this in Zend Framework, what benefits does it add? Why not just use the normal php exceptions?

  • 写回答

2条回答 默认 最新

  • dongyu2300 2011-12-03 22:33
    关注

    The class names of the exceptions can be used when you catch exceptions and you can handle different types of exceptions in different ways. Generally, each module in the zend framework has different exception classes.

    For example, if you're using Zend_Queue, the library will return Zend_Queue_Exception exceptions, which extends Zend_Exception. It might also return Zend_Db_Exception exceptions if the exception is related to the queue database adapter.

    $options = array(
                'name' => 'queue',
                'driverOptions' => $options
            );
    try {       
      $queue = new Zend_Queue($config->queue->adapter, $options);
    } catch (Zend_Queue_Exception $e) {
        // handle queue issues
    } catch (Zend_Db_Exception $e) {
     // handle db issues
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法