There are no religious or other prejudices against / bans on onanism, so this is not an issue. It's just about the awkwardness of the situation.
This happened some time ago and I still wonder what I should/could have done better.
Situation
Bob is a relative of mine around the age of puberty. I am about ten years his senior.
I was visiting another relative during holidays, so were Bob and his family. When I arrived, no cars were parked outside, so I thought nobody was at home. Unbeknownst to me, the others had left for while, except for Bob.
I went to one of the bedrooms to store my luggage and swiftly opened the door. Bob hadn't heard my steps and was masturbating. For sure, I was quite surprised when I saw him and he was startled. I immediately closed the door and went into the other bedroom.
He kept some distance from me for the rest of our stay, as if he was ashamed (blushing when he became aware of me, avoiding eye contact etc.). Apart from that, we interacted normally, so no one else probably noticed something. My reaction was to not talk about the incident and act, as if nothing had happened.
Question
My goal is for Bob to feel comfortable and not ashamed and to get over it soon.
I do not have a problem with what he did and don't think, that we should make a mountain out of a molehill. But I got the feeling, that for Bob it must have been very uncomfortable, because I "caught" him literally pants down and he is a bit shy (I imagine it would have been easier had a male relative surprised him).
What would have been a good response to the incident?
I'm not sure, if my reaction (acting as if nothing had happened) was the best. What are better approaches to ease Bob's pain?
On a note: Since he is not part of my immediate family, we see each other irregularly.