Learning from your past can save you heartache in the future.