Concept

What types of errors can occur when processing files?

ComputerScienceOne / Error Handling

"When dealing with files there are many potential error conditions that may be anticipated and may need to be dealt with. Some types of errors that can occur include the following.\n\n• Permission errors – Your program may not have the proper permissions to read or write to a particular directory or file. For example, user-level processes typically do not have permissions to read system-level files (such as password files) nor can they write to them lest they corrupt critical system data.\n\n• File Not Found errors – Your program may attempt to open a file that does not exist. Sometimes, particularly when writing, the file will be created if it does not exist. However, for reading, this may be a serious error.\n\n• I/O Errors – We may be able to successfully find and open a file, but while processing it something might go wrong with the file system that results in a general input/output error.\n\n• Formatting errors – As previously mentioned, the format of a file is highly dependent on the application that created it (though there are universal data formats such as XML or JavaScript Object Notation (JSON)). If the format is not as expected the file may be corrupted and the program may not be able to successfully read data from it. Depending on the language, these errors may be fatal or may result in error codes or error values that can be dealt with. Or they may result in exceptions that can be caught and handled."

Related Ideas

What types of errors can occur when processing files? | ComputerScienceOne | Bifalgorithm | Bifalgorithm