Add try-catch statement to handle the error