2024 日本 PHP 研討會

MongoDB\Driver\Exception\RuntimeException 類別

(mongodb >= 1.0.0)

簡介

當驅動程式遇到執行階段錯誤時拋出(例如來自 » libmongoc 的內部錯誤)。

類別概要

類別 MongoDB\Driver\Exception\RuntimeException 繼承自 RuntimeException 實作 MongoDB\Driver\Exception\Exception {
/* 屬性 */
/* 繼承的屬性 */
保護 字串 $message = "";
私有 字串 $string = "";
保護 整數 $code;
保護 字串 $file = "";
保護 整數 $line;
私有 陣列 $trace = [];
私有 ?Throwable $previous = null;
/* 方法 */
最終 公開 hasErrorLabel(字串 $errorLabel): 布林值
/* 繼承的方法 */
最終 公開 Exception::getMessage(): 字串
最終 公開 Exception::getCode(): 整數
最終 公開 Exception::getFile(): 字串
最終 公開 Exception::getLine(): 整數
最終 公開 Exception::getTrace(): 陣列
}

屬性

errorLabels (錯誤標籤)

包含一個與異常搭配的錯誤標籤陣列。例如,如果存在 TransientTransactionError 標籤,則可以使用錯誤標籤來檢測事務是否可以安全地重試。應該使用 MongoDB\Driver\Exception\RuntimeException::hasErrorLabel() 方法來測試特定錯誤標籤是否存在,而不是手動解讀 errorLabels 屬性。

更新日誌

版本 說明
PECL mongodb 1.6.0

新增了 MongoDB\Driver\Exception\RuntimeException::hasErrorLabel() 方法和 MongoDB\Driver\Exception\RuntimeException::errorLabels 屬性。

目錄

新增筆記

使用者貢獻的筆記

此頁面沒有使用者貢獻的筆記。
To Top