File processing and exception handling