basic root dir pre check on fs storage.New (#199)

* basic root dir pre check on fs storage.New

* update uses of fs.storage.New to check for error

* use testify to check for error
This commit is contained in:
Rob j Loranger
2018-06-26 11:37:21 -07:00
committed by Aaron Schlesinger
parent 9e76722acc
commit 5101e1ea6d
5 changed files with 25 additions and 6 deletions
+4 -1
View File
@@ -35,7 +35,10 @@ func GetStorage() (storage.BackendConnector, error) {
if err != nil {
return nil, fmt.Errorf("missing disk storage root (%s)", err)
}
s := fs.NewStorage(storageRoot, afero.NewOsFs())
s, err := fs.NewStorage(storageRoot, afero.NewOsFs())
if err != nil {
return nil, fmt.Errorf("could not create new storage from os fs (%s)", err)
}
return storage.NoOpBackendConnector(s), nil
case "postgres", "sqlite", "cockroach", "mysql":
storageRoot, err = envy.MustGet("ATHENS_RDBMS_STORAGE_NAME")