try-catch js snippet