throw a exception if we can't handle the provided path
some small fixed, suggested by scrutinizer