Did I deserve detention because of this?

Thinking about this time last year when i was in high school i asked one of my teachers to go to the bathroom when i got into class. She tells me ok as long as i make it back before the bell rings. I hurry up and pee and as im like 2 meters from the door, the bell rings and she tells me that im late and that im walking in the wrong directions so im "definitely getting a detention." I know it was a year ago but it still bothers me.

Did I deserve detention because of this?
Post Opinion