protected function extractMessageFromErrorResponse(string $responseContents, string $fallbackMessage): string
    {
        $result = $fallbackMessage;
        try {
            $errorResponse = $this->serializer->deserialize($responseContents, ErrorResponse::class, 'json');

            if ($errorResponse instanceof ErrorResponse) {
                $result = $errorResponse->getError()->getMessage();
            }
        } catch (Exception $e) {
            // Failed to decode error response.
        }
        return $result;
    }