Handles any exception correctly