add switch to control throw error