-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved logging and exception handling
- Loading branch information
John Pancoast
committed
Apr 20, 2014
1 parent
3da2dec
commit c1e35f5
Showing
3 changed files
with
88 additions
and
15 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
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
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 |
---|---|---|
|
@@ -14,4 +14,55 @@ | |
* | ||
* @author John Pancoast <[email protected]> | ||
*/ | ||
class RequiredCommandOptionException extends \Exception {} | ||
class RequiredCommandOptionException extends \Exception | ||
{ | ||
/** | ||
* @var string The key that failed | ||
* | ||
* @access private | ||
*/ | ||
private $key; | ||
|
||
/** | ||
* Override parent constructor. | ||
* | ||
* Note that we allow a string for our second param for the key that failed | ||
* but we call the parent without the second param which is | ||
* (long)code in exception) | ||
* | ||
* @access public | ||
* {@inheritDoc} | ||
* @param string $message The exception message | ||
* @param string $key The key that failed. | ||
*/ | ||
public function __construct($message, $key) | ||
{ | ||
$this->setKey($key); | ||
parent::__construct($message); | ||
} | ||
|
||
/** | ||
* Set the key that failed | ||
* | ||
* @access public | ||
* @param string $key The key that failed. | ||
* @return self | ||
*/ | ||
public function setKey($key) | ||
{ | ||
$this->key = $key; | ||
|
||
return $this; | ||
} | ||
|
||
/** | ||
* Get the key that failed | ||
* | ||
* @access public | ||
* @return string | ||
*/ | ||
public function getKey() | ||
{ | ||
return $this->key; | ||
} | ||
} |