DuplicateTabException.php
25 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\DonorDashboards\Exceptions; |
| 4 | |
| 5 | use Exception; |
| 6 | |
| 7 | /** |
| 8 | * @since 2.10.0 |
| 9 | */ |
| 10 | class DuplicateTabException extends Exception { |
| 11 | |
| 12 | // Redefine the exception so message is pre-defined |
| 13 | public function __construct( $message = 'A tab can only be added once. Make sure there are not id conflicts.', $code = 0, Exception $previous = null ) { |
| 14 | // some code |
| 15 | |
| 16 | // make sure everything is assigned properly |
| 17 | parent::__construct( $message, $code, $previous ); |
| 18 | } |
| 19 | |
| 20 | // custom string representation of object |
| 21 | public function __toString() { |
| 22 | return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; |
| 23 | } |
| 24 | } |
| 25 |