Where do you define MyFileException and getErrorMessage? Do you have a "use MyFileExceptionclass;" statement somewhere? Is there a "new" method in that class?
The error message clearly indicates MyFileException and getErrorMessage are not defined.
I think we need more code to figure out what is going on here.