PHP-on-couch中的Try/Catch块没有捕获异常


Try/Catch block in PHP-on-couch not catching Exception

我有以下PHP代码:

try{
$doc = couchDocument::getInstance($db,"document10");
}catch(couchExpention $e){
    echo $e->getMessage();
}

然而,我得到的不是期望的输出:

PHP Fatal error:  Uncaught exception 'couchNotFoundException' with message 'Object Not Found - missing (GET /db/document10[])' in /var/www/public_html/lib/couchClient.php:1012
Stack trace:
#0 /var/www/public_html/lib/couchClient.php(157): couchException::factory(Array, 'GET', '/db/169488e77e2...', Array)
#1 /var/www/public_html/lib/couchClient.php(427): couchClient->_queryAndTest('GET', '/db/169488e77e2...', Array, Array)
#2 /var/www/public_html/lib/couchDocument.php(47): couchClient->getDoc('169488e77e2j385...')
#3 /var/www/public_html/lib/couchDocument.php(102): couchDocument->load('169488e77e2j385...')
#4 /var/www/public_html/index.php(8): couchDocument::getInstance(Object(couchClient), '169488e77e2j385...')
#5 {main}
  thrown in /var/www/public_html/lib/couchClient.php on line 1012

您的代码试图捕获couchExpention而不是couchException