mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 06:15:19 +08:00
Fix #19454: Fix PDO exception code not properly passed to yii\db\Exception
This commit is contained in:
@ -37,6 +37,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #19400: Fix passing null in `yii\web\Response::redirect()` (bizley)
|
||||
- Enh #19437: Add support to specify request port by trusted proxies in `\yii\web\Request::getServerPort()` (rhertogh)
|
||||
- Bug #19445: Fix caching in `yii\i18n\Formatter::getUnitMessage()` (WinterSilence)
|
||||
- Bug #19454: Fix PDO exception code not properly passed to `yii\db\Exception` (Roguyt)
|
||||
|
||||
|
||||
2.0.45 February 11, 2022
|
||||
|
@ -269,10 +269,10 @@ class Command extends Component
|
||||
} catch (\Exception $e) {
|
||||
$message = $e->getMessage() . "\nFailed to prepare SQL: $sql";
|
||||
$errorInfo = $e instanceof \PDOException ? $e->errorInfo : null;
|
||||
throw new Exception($message, $errorInfo, (int) $e->getCode(), $e);
|
||||
throw new Exception($message, $errorInfo, $e->getCode(), $e);
|
||||
} catch (\Throwable $e) {
|
||||
$message = $e->getMessage() . "\nFailed to prepare SQL: $sql";
|
||||
throw new Exception($message, null, (int) $e->getCode(), $e);
|
||||
throw new Exception($message, null, $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@ class Connection extends Component
|
||||
Yii::endProfile($token, __METHOD__);
|
||||
}
|
||||
|
||||
throw new Exception($e->getMessage(), $e->errorInfo, (int) $e->getCode(), $e);
|
||||
throw new Exception($e->getMessage(), $e->errorInfo, $e->getCode(), $e);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user