Modify calculator.js. Add try-catch