mirror of
https://github.com/SociallyDev/Spaces-API.git
synced 2025-08-14 02:27:23 -07:00
spaces.php
This commit is contained in:
parent
7755490b81
commit
eefa32741e
845 changed files with 50409 additions and 0 deletions
31
aws/Aws/Api/ErrorParser/JsonRpcErrorParser.php
Normal file
31
aws/Aws/Api/ErrorParser/JsonRpcErrorParser.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
namespace Aws\Api\ErrorParser;
|
||||
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
/**
|
||||
* Parsers JSON-RPC errors.
|
||||
*/
|
||||
class JsonRpcErrorParser
|
||||
{
|
||||
use JsonParserTrait;
|
||||
|
||||
public function __invoke(ResponseInterface $response)
|
||||
{
|
||||
$data = $this->genericHandler($response);
|
||||
// Make the casing consistent across services.
|
||||
if ($data['parsed']) {
|
||||
$data['parsed'] = array_change_key_case($data['parsed']);
|
||||
}
|
||||
|
||||
if (isset($data['parsed']['__type'])) {
|
||||
$parts = explode('#', $data['parsed']['__type']);
|
||||
$data['code'] = isset($parts[1]) ? $parts[1] : $parts[0];
|
||||
$data['message'] = isset($data['parsed']['message'])
|
||||
? $data['parsed']['message']
|
||||
: null;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue