throw error if listener isnt'a function