$this->db = $db;
parent::__construct( $error );
}
+}
+/**
+ * Base class for the more common types of database errors. These are known to occur
+ * frequently, so we try to give friendly error messages for them.
+ *
+ * @ingroup Database
+ * @since 1.23
+ */
+class DBExpectedError extends DBError {
/**
* @return string
*/
* @return string
*/
protected function getHTMLContent() {
- return '<p>' . nl2br( htmlspecialchars( $this->getMessage() ) ) . '</p>';
+ return '<p>' . nl2br( htmlspecialchars( $this->getTextContent() ) ) . '</p>';
}
}
/**
* @ingroup Database
*/
-class DBConnectionError extends DBError {
+class DBConnectionError extends DBExpectedError {
/** @var string Error text */
public $error;
}
/**
- * @return boolean
+ * @return bool
*/
function isLoggable() {
// Don't send to the exception log, already in dberror log
/**
* @ingroup Database
*/
-class DBQueryError extends DBError {
+class DBQueryError extends DBExpectedError {
public $error, $errno, $sql, $fname;
/**