A simple answer is to defend your body. But it depends on emotional pain or physical pain. Physical pain is a reaction produced by your nerves and then a signal is sent to your brain to take action (like moving your hand away from a fire when it's burning. Emotional pain is a reaction based on your interpretation of an event. Your interpretation can be variable due to how you were brought up, your values, compassion, and simply who you are. Not all pain is bad though sometimes it may teach you something about yourself such as turning around from a dangerous lifestyle. The good thing is all things are temporary and you are only as happy as you make your mind up to be. If you live with conditional happiness (I.E. I'll be happy when.......I get married or have a child or make more money) you will probably always be miserable because your happiness is codependant on circumstances rather than making the best of any situation.
Nerves are there so you can know when something is pushing you bodies' tolerance. Say if you put your hand without knowing it on a hot stove. You could leave it there until you look at it being literally melted.