The vast majority of applications does not handle "disk full" scenarios properly.
Example: an installer doesn't see that the disk is full, ignores all errors, and finally happily announces "installation complete!", or an email program is unaware that the message it has just downloaded could not be saved, and tells the server to delete the original.
What techniques are there to handle this situation gracefully? Do you use them? Do you test them?
As a user, I want software to:
- Preserve my data.
- Validate my environment as early as possible, before I do any real work.
- If
#2
is impossible, tell me about any special requirements.
- Clean up after itself.
As a developer, techniques to do this include:
- Aborting only when there is no alternative, and allowing the user a chance to make a new choice if the previous one fails (see AgentThirteen's answer).
- Checking for required resources (memory, disk space, peripherals) as early as possible. Stop immediately if failure is certain; display a warning if success is uncertain, allowing the user to choose whether to continue.
- Pre-allocating resources to ensure they will still be available when they are required.
- Displaying warnings and errors in non-modal dialogs so the user can place the application in the background and use other tools to fix the problem.
- Maintaining an "undo" list: the history of actions that have been performed so far. If the application must abort, offer an opportunity to undo those actions.