Exception handling in main method