What would you do?? Please help

So I’m 16 weeks and an elementary school teacher. My classroom has a door that leads to another classroom and whenever I have to go to the bathroom, I just open the door and that teacher listens out/watches my class until I get back.

Well, today I did that and as I was walking out, my principal was walking in and I explained to her (she knows I’m pregnant too, btw) that I was going to the bathroom and I would be right back but the other teacher is watching them. And she immediately started yelling at me. I guess she expects me to hold it until my breaks but they are far apart. And holding it in isn’t healthy at all.

What would you do?? I’m so mad but yet confused at the same time.