Catch IOException?

Can you copy the full details of the error message? It’s probably calling out to open the file along a different code path; there may or may not be a way to work around the issue.