wrapped JS into try / catch