The first one is: the classroom invigilator catches it, and the result is: the cheating notes are confiscated, or you are allowed to hand in the papers directly. Don't worry about this situation, nothing happened! That teacher just won't let you cheat! He has no right to punish you. At most, he grabs your paper, won't let you answer it, and drives you out of the examination room! The teacher just confiscated the note and asked you to continue answering questions, which shows that this teacher is very good! Don't worry, you won't be punished and you won't get into trouble afterwards.
The second type: being caught by the mobile invigilator. This situation not only confiscates the paper, but also makes you sign it (if you don't sign it, do whatever it takes). After signing, you will be punished according to the rules and regulations of the school-for example, if you record a demerit, your signature will prove that you cheated! So I was caught by the mobile invigilator, so I quickly dropped the paper and ran (I'd rather not get in the exam, I don't remember) or found a guide and other teachers to clear the relationship!
According to what you said, you will be fine! Don't worry!