Error handling in main.