change throw error and add defaultError