Cleaning up the error reporting in the main loop.