Which of the following ways to work with this precondition is more desirable and what are the more important consequences?
1:
If Not Exists(File) Then
ThrowException
Exit
End If
File.Open
...work on file...
2:
If Exists(File) Then
File.Open
....work on file...
Else
ThrowException
Exit
End
Note. Checking for a file is just an example of a HANDLE prerequisite. Clearly, there is a good argument for checking for files themselves throwing their own exceptions up.
source
share