javascript throw error inside try catch