Thanks for asking the question, Debra! Here are my thoughts:
You indicated that staying in the room was difficult--I would imagine so, as I know pinched nerves can be painful! If I were in your shoes, I might have approached the moment, not as a missed opportunity to do yoga postures, but as a sudden opportunity to practice stillness and mental focus. Sometimes it is possible to transform what seems to be a negative situation into a positive situation, or at least to create an opportunity out of a setback. I know we spend most of our time in the studios focusing on the postures (as we should, that's why most students go to a yoga class, after all!), but traditionally there are "8 Limbs" of yoga, only 1 of which is Asana (the postures). Pranayama (breathing / breath control) is another limb unto itself. We start and finish each class with specific Pranayama exercises, and at certain moments during class we encourage students to focus on taking deep, slow, even breaths. Focusing on the breathing for 40 minutes would be a challenge (especially with a pinched nerve!), but it would be a good way to cultivate another aspect of your yoga practice. You might even discover a clearer state of mind afterward.
From my perspective as a teacher, you got it right--the main concern isn't necessarily the impoliteness, but rather concern over your health and safety. Once you leave the room we're not sure if things are OK without stepping out to check on you. So, as always, if you absolutely need to leave the room, please do, and try to get eye contact with the teacher and maybe a nod indicating you'll be OK (if that is the case). But if the reason to leave the room pertains mostly to discomfort, I would recommend focusing on breathing and doing your best to stay in the room, always in the context of using good judgement regarding your physical state. Like we say, "honor your body in your practice" :-)