hoffmangroup / genomedata

The Genomedata format for storing large-scale functional genomics data.
https://genomedata.hoffmanlab.org/
GNU General Public License v2.0
2 stars 1 forks source link

Better error messages when files/directories already exist when attempting to create Genomedata archives #42

Open EricR86 opened 6 years ago

EricR86 commented 6 years ago

Original report (archived issue) by Eric Roberts (Bitbucket: ericr86, GitHub: ericr86).


Currently in _load_seq.py there are a lot of assertions without helpful error messages when it comes to the cases if a genomedata folder/file already exists and trying to create the opposite file/folder type.

    if mode == "dir":
        if gdpath.exists():
            assert gdpath.isdir()
        else:
            gdpath.makedirs()
    elif mode == "file":
        assert not gdpath.exists()
        gdpath.touch()  # Create file (then Genomedata archive will be a file)
EricR86 commented 6 years ago

Original comment by Michael Hoffman (Bitbucket: hoffman, GitHub: michaelmhoffman).


Agree, this would be nice. Probably most of the assertions here and elsewhere should be turned into raising into proper exceptions with sensible error messages.