It's your own foolishness in trying to take something without permission that gave you away.
You were given away because you tried to steal.