private function parseErrorResponse(ResponseInterface $response): array
    {
        $error = [
            'code' => null,
            'message' => null,
        ];
        // Try to parse Edge error message and error code from the response body.
        $contentTypeHeader = $response->getHeaderLine('Content-Type');
        if ($contentTypeHeader && false !== strpos($contentTypeHeader, 'application/json')) {
            $array = json_decode((string) $response->getBody(), true);
            if (JSON_ERROR_NONE === json_last_error()) {
                if (array_key_exists('fault', $array)) {
                    $error['message'] = $array['fault']['faultstring'] ?? null;
                    $error['code'] = $array['fault']['detail']['errorcode'] ?? null;
                } else {
                    if (array_key_exists('code', $array)) {
                        $error['code'] = $array['code'];
                    }
                    if (array_key_exists('message', $array)) {
                        // It could happen that the returned message by
                        // Apigee Edge is also an array.
                        $error['message'] = is_array($array['message']) ? json_encode($array['message']) : $array['message'];
                    }
                }
            }
        }

        return $error;
    }