check_dir is an existing function where you raise the exception and I guess it should not be catched everywhere. I guess I could make another wrapping function for this case.