private static function getMessage(ResponseInterface $response)
    {
        try {
            if ($error = ResponseMediator::getContent($response)['error'] ?? null) {
                if ($message = $error['message'] ?? null) {
                    if ($detail = $error['detail'] ?? null) {
                        return sprintf('%s: %s', $message, strtok($detail, "\n"));
                    } else {
                        return $message;
                    }
                }
            }
        } catch (DecodingFailedException $e) {
            // return nothing
        }
    }