When I use the Exception provided by the SPL the options are limited. So it's hard to pick which exception would be best suited to handle File exceptions.
I know the best scenario is to write my own Exception (FileException or something), but I was wondering if the SPL could provide of some use here.
I'm currently thinking that the RuntimeException might be the best candidate, because the documentation states:
Exception thrown if an error which can only be found on runtime occurs.
And for files this is mostly the case. For example:
- File does not exist
- File is not readable
- File cannot be opened
What is the PHP community's thought on this one?