Binette to Learn [email protected]English • 3 months agoIs it better to check if a file exists before trying to load it, or to try to load it, and catch the error and move on?message-square16fedilinkarrow-up137arrow-down10file-text
arrow-up137arrow-down1message-squareIs it better to check if a file exists before trying to load it, or to try to load it, and catch the error and move on?Binette to Learn [email protected]English • 3 months agomessage-square16fedilinkfile-text
minus-square@[email protected]linkfedilink9•3 months agoWell you need to try and catch when getting the file anyways, it’s probably very rare but imagine a scenario of: Check if file exists user deletes file in between (try) opening the file Or the file could exist, but you don’t have permissions to actually open it. So a bunch of languages / already have their own “try open file”
Well you need to try and catch when getting the file anyways, it’s probably very rare but imagine a scenario of:
Or the file could exist, but you don’t have permissions to actually open it.
So a bunch of languages / already have their own “try open file”