If it helps and if you want to keep with the code flow you have above then you can always insert the following just after the first fPref = True above and it will raise an IOException and drop you into the catch.
Var e as New IOException
e.Message = "Some message" // can comment out this step as you don't use the message in the dialog anyway
e.ErrorNumber = 101 // can comment out this step as you don't use the errornumber in the dialog anyway
Raise e
or just the following if you don’t want to set a message or error number:
Raise New IOException