private function getApiErrorMessage(ResponseInterface $response): string
    {
        try {
            $body = $response->getBody()->getContents();
        } catch (\RuntimeException $re) {
            return '';
        }

        if (strpos($body, '"Error"') !== false
            && ($body = json_decode($body, true))
            && array_key_exists('Error', $body)
        ) {
            return $body['Error'];
        }

        return '';
    }
private function getApiErrorMessage(ResponseInterface $response): string
    {
        try {
            $body = $response->getBody()->getContents();
        } catch (\RuntimeException $re) {
            return '';
        }

        if (strpos($body, '"Error"') !== false
            && ($body = json_decode($body, true))
            && array_key_exists('Error', $body)
        ) {
            return $body['Error'];
        }

        return '';
    }
private function getApiErrorMessage ( ResponseInterface $ response ) : string { try { $ body = $ response -> getBody ( ) -> getContents ( ) ; } catch ( \ RuntimeException $ re ) { return '' ; } if ( strpos ( $ body , '"Error"' ) !== false && ( $ body = json_decode ( $ body , true ) ) && array_key_exists ( 'Error' , $ body ) ) { return $ body [ 'Error' ] ; } return '' ; }
Extract error message from response body.

@param ResponseInterface $response
@return string
Extract error message from response body .