What Was Onan's Sin?

Bobby talks about what constituted Onan's sin in Genesis 38.