You must distinguish between best practices and absolute requirements. It is recommended that you first check the file before trying to access it. However, this cannot be realized. Since this is an absolute requirement that a file exist before it is accessed, the infrastructure will throw an exception to enforce this condition.
In an ideal world, there would be no exceptions, because there would be no errors, and all programs and networks (and users!) Would be absolutely perfect.
source
share