Use try/catch to guard against console.log errors