I am writing a GUI program, and one of the routines requires that I choose a file to be my data file. If the data file is chosen correctly, then my program will send it to a subroutine which will perform a bunch of methods and ultimately construct a large matrix and return it.
Obviously, a user can import the wrong file, and when my subroutines act on this, then they are going to error. Because the user can import a bunch of different wrong files, I can't anticipate what error will present itself. For example, IndexError vs. ValueError. Therefore, I'd like to do something like is presented in the following metacode:
Imported file = f Try: Run subroutines on f Except AllErrorsImaginable: Run some complaint statement
Basically, I can't think of a better way of doing this without just putting every error type in the ``AllErrorsImaginable'' block. This doesn't seem very elegant. Any tips?