bam cli: give useful message when bam ls
fails
This commit is contained in:
@@ -82,7 +82,7 @@ class bam_config:
|
|||||||
if filepath is None:
|
if filepath is None:
|
||||||
import sys
|
import sys
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
"fatal: Not a git repository "
|
"fatal: Not a bam repository "
|
||||||
"(or any of the parent directories): .bam\n")
|
"(or any of the parent directories): .bam\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@@ -416,7 +416,13 @@ class bam_utils:
|
|||||||
stream=True,
|
stream=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
items = r.json().get("items_list", ())
|
r_json = r.json()
|
||||||
|
items = r_json.get("items_list", None)
|
||||||
|
if items is None:
|
||||||
|
import sys
|
||||||
|
sys.stderr.write("fatal: %s\n" % r_json.get("message", "<empty>"))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
items.sort()
|
items.sort()
|
||||||
|
|
||||||
for (name_short, name_full, file_type) in items:
|
for (name_short, name_full, file_type) in items:
|
||||||
|
@@ -93,6 +93,10 @@ class DirectoryAPI(Resource):
|
|||||||
absolute_path_root = os.path.join(absolute_path_root, path)
|
absolute_path_root = os.path.join(absolute_path_root, path)
|
||||||
parent_path = os.pardir
|
parent_path = os.pardir
|
||||||
|
|
||||||
|
|
||||||
|
if not os.path.isdir(absolute_path_root):
|
||||||
|
return jsonify(message="Path is not a directory %r" % absolute_path_root)
|
||||||
|
|
||||||
items_list = []
|
items_list = []
|
||||||
|
|
||||||
for f in os.listdir(absolute_path_root):
|
for f in os.listdir(absolute_path_root):
|
||||||
|
Reference in New Issue
Block a user