try to create the directory before throwing an exception