throw error when setState's arguments are bad

fixes #820