Skip to content

Commit

Permalink
friendlier errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dmd committed Feb 13, 2024
1 parent 4087e8c commit a316721
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions iris/iris-get.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,20 @@
if args.authfile:
cmd.insert(1, "--alias")
cmd.insert(2, "iris")
ret = subprocess.call(
cmd,
cp = subprocess.run(
args=cmd,
capture_output=True,
text=True,
env=dict(
os.environ,
XNAT_PASS=password,
XNAT_USER=args.username,
XNAT_HOST="https://iris.mclean.harvard.edu",
),
)
if ret != 0:
raise RuntimeError('ArcGet.py call failed.')
if cp.returncode != 0:
if '401' in cp.stderr:
print("\n\033[1m * \n * Your Iris username or password is incorrect.\n *\n\033[0m")
if 'NoExperimentsError' in cp.stderr:
print("\n\033[1m * \n * The accession number you requested was not found\n * or is not available to you.\n *\n\033[0m")
print('ArcGet.py call failed: ' + cp.stderr.split("\n")[-2])

0 comments on commit a316721

Please sign in to comment.