MissingTabException.php
26 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\DonorDashboards\Exceptions; |
| 4 | |
| 5 | use Exception; |
| 6 | |
| 7 | /** |
| 8 | * @since 2.10.0 |
| 9 | */ |
| 10 | class MissingTabException extends Exception { |
| 11 | |
| 12 | // Redefine the exception so tab ID isn't optional |
| 13 | public function __construct( $tabId, $code = 0, Exception $previous = null ) { |
| 14 | |
| 15 | $message = "No tab exists with the ID {$tabId}"; |
| 16 | |
| 17 | // make sure everything is assigned properly |
| 18 | parent::__construct( $message, $code, $previous ); |
| 19 | } |
| 20 | |
| 21 | // custom string representation of object |
| 22 | public function __toString() { |
| 23 | return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; |
| 24 | } |
| 25 | } |
| 26 |