1.2.1081. Set Chaining Exception¶
Chaining exception allows rethrowing a caught exception with a new one. The previous exception is added to the new exception, for later reference.
For that, the constructor of the chaining exception must relay the previous one to the parent constructor.
<?php
//
class myChainingException{
function __construct($message, $code = 0, \Throwable $exception = null) {
// This exception can be chained
parent::__construct($message, $code, $exception);
}
}
// No chaining possible
class myException{
function __construct($message) {
// This exception can't chain anything
parent::__construct($message);
}
}
?>
1.2.1081.1. Connex PHP features¶
1.2.1081.1.1. Suggestions¶
Add the default values to allow chaining
1.2.1081.1.2. Specs¶
Short name |
Exceptions/SetChainingException |
Rulesets |
|
Exakat since |
2.5.0 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |