-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
automatix
committed
Jul 19, 2018
1 parent
a0c3884
commit 39f8249
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
namespace App\Base\Exceptions; | ||
|
||
/** | ||
* Class GeneralErrorContextCode | ||
* | ||
* @method static GeneralErrorContextCode GENERAL_ERROR() | ||
* @method static GeneralErrorContextCode INVALID_ARGUMENT() | ||
*/ | ||
class GeneralErrorContextCode extends AbstractErrorCode | ||
{ | ||
|
||
const GENERAL_ERROR = 1; | ||
const INVALID_ARGUMENT = 2; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
namespace App\Base\Exceptions; | ||
|
||
use Exception; | ||
|
||
/** | ||
* Class GeneralException | ||
*/ | ||
class GeneralException extends AbstractException | ||
{ | ||
|
||
public function __construct($message = '', GeneralErrorContextCode $code, Exception $previous = null) | ||
{ | ||
if ($code === null) { | ||
$code = GeneralErrorContextCode::GENERAL_ERROR(); | ||
} | ||
parent::__construct($message, $code, $previous); | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getContext() | ||
{ | ||
return "GEN"; | ||
} | ||
|
||
} |