 Usually, code for a graceful exit exists when the alternative—allowing the error to go undetected and unhandled—would produce spurious errors or later anomalous behavior that would be more difficult for the programmer to debug.The code associated with a graceful exit may also take additional steps, such as closing files, to ensure that the program leaves data in a consistent, recoverable state.Graceful exits are not always desired.