Add exception handling. There should be a common exception for blank directory chosen since some other tools doesn't handle this.