Connection.php
protected function decodeErrorBody($body)
    {
        try {
            $decoded = Json::decode($body);
            if (isset($decoded['error']) && !is_array($decoded['error'])) {
                $decoded['error'] = preg_replace('/\b\w+?Exception\[/', "<span style=\"color: red;\">\\0</span>\n               ", $decoded['error']);
            }
            return $decoded;
        } catch(InvalidParamException $e) {
            return $body;
        }
    }
protected function decodeErrorBody($body)
    {
        try {
            $decoded = Json::decode($body);
            if (isset($decoded['error']) && !is_array($decoded['error'])) {
                $decoded['error'] = preg_replace('/\b\w+?Exception\[/', "<span style=\"color: red;\">\\0</span>\n               ", $decoded['error']);
            }
            return $decoded;
        } catch(InvalidParamException $e) {
            return $body;
        }
    }
protected function decodeErrorBody ( $ body ) { try { $ decoded = Json :: decode ( $ body ) ; if ( isset ( $ decoded [ 'error' ] ) && ! is_array ( $ decoded [ 'error' ] ) ) { $ decoded [ 'error' ] = preg_replace ( '/\b\w+?Exception\[/' , "<span style=\"color: red;\">\\0</span>\n               " , $ decoded [ 'error' ] ) ; } return $ decoded ; } catch ( InvalidParamException $ e ) { return $ body ; } }
Try to decode error information if it is valid json, return it if not.
@param $body
@return mixed
Try to decode error information if it is valid json return it if not .