removeFileOrDirectory does not throw its own errors
Convert generic 'fail' calls to specific exception types