Using try/except blocks for error handling