-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change ApiErrorException to ClientException.
- Loading branch information
Showing
4 changed files
with
68 additions
and
52 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 was deleted.
Oops, something went wrong.
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,63 @@ | ||
<?php | ||
|
||
namespace Polidog\Esa\Exception; | ||
|
||
class ClientException extends \RuntimeException | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $method; | ||
|
||
/** | ||
* @var string | ||
*/ | ||
private $path; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $params; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getMethod() | ||
{ | ||
return $this->method; | ||
} | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function getPath() | ||
{ | ||
return $this->path; | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getParams() | ||
{ | ||
return $this->params; | ||
} | ||
|
||
/** | ||
* @param \Exception $e | ||
* @param $method | ||
* @param $path | ||
* @param array $params | ||
* | ||
* @return ClientException | ||
*/ | ||
public static function newException(\Exception $e, $method, $path, array $params) | ||
{ | ||
$self = new self(sprintf('Api method error: %s : %s', $method, $path), $e->getCode(), $e); | ||
$self->method = $method; | ||
$self->path = $path; | ||
$self->params = $params; | ||
|
||
return $self; | ||
} | ||
} |
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