javascript throw error in try catch