CommonException.php 409 B

12345678910111213141516171819202122
  1. <?php
  2. namespace App\Exceptions;
  3. class CommonException extends \Exception
  4. {
  5. /**
  6. * CommonException constructor.
  7. */
  8. public function __construct($arr,$replace="")
  9. {
  10. if(is_string($arr)){
  11. parent::__construct($arr);
  12. }elseif(is_array($arr)){
  13. $errorMsg = $replace?$replace:$arr[1];
  14. parent::__construct($errorMsg,$arr[0]);
  15. }
  16. }
  17. }