Skip to content
Snippets Groups Projects
Commit 1e64e074 authored by Jameson Rollins's avatar Jameson Rollins
Browse files

cli: tweak error strings

parent b57acef8
No related branches found
No related tags found
No related merge requests found
...@@ -120,9 +120,9 @@ def main(): ...@@ -120,9 +120,9 @@ def main():
if os.path.splitext(os.path.basename(args.IFO))[1] in io.DATA_SAVE_FORMATS: if os.path.splitext(os.path.basename(args.IFO))[1] in io.DATA_SAVE_FORMATS:
if args.freq: if args.freq:
parser.exit(2, "Frequency specification not allowed when loading traces from file.\n") parser.exit(2, "Error: Frequency specification not allowed when loading traces from file.\n")
if args.ifo: if args.ifo:
parser.exit(2, "IFO parameter specification not allowed when loading traces from file.\n") parser.exit(2, "Error: IFO parameter specification not allowed when loading traces from file.\n")
from .io import load_hdf5 from .io import load_hdf5
budget = None budget = None
name = args.IFO name = args.IFO
...@@ -139,7 +139,7 @@ def main(): ...@@ -139,7 +139,7 @@ def main():
try: try:
budget = load_budget(args.IFO, freq=freq) budget = load_budget(args.IFO, freq=freq)
except RuntimeError as e: except RuntimeError as e:
parser.exit(2, str(e)+'\n') parser.exit(2, f"Error: {e}\n")
name = budget.name name = budget.name
ifo = budget.ifo ifo = budget.ifo
plot_style = getattr(budget, 'plot_style', {}) plot_style = getattr(budget, 'plot_style', {})
...@@ -154,17 +154,17 @@ def main(): ...@@ -154,17 +154,17 @@ def main():
if args.yaml: if args.yaml:
if not ifo: if not ifo:
parser.exit(2, "IFO structure not provided.\n") parser.exit(2, "Error: IFO structure not provided.\n")
print(ifo.to_yaml(), end='') print(ifo.to_yaml(), end='')
return return
if args.text: if args.text:
if not ifo: if not ifo:
parser.exit(2, "IFO structure not provided.\n") parser.exit(2, "Error: IFO structure not provided.\n")
print(ifo.to_txt(), end='') print(ifo.to_txt(), end='')
return return
if args.diff: if args.diff:
if not ifo: if not ifo:
parser.exit(2, "IFO structure not provided.\n") parser.exit(2, "Error: IFO structure not provided.\n")
dbudget = load_budget(args.diff) dbudget = load_budget(args.diff)
diffs = ifo.diff(dbudget.ifo) diffs = ifo.diff(dbudget.ifo)
if diffs: if diffs:
...@@ -205,7 +205,7 @@ def main(): ...@@ -205,7 +205,7 @@ def main():
except ImportError as e: except ImportError as e:
parser.exit(5, f"ImportError: {e}\n") parser.exit(5, f"ImportError: {e}\n")
except RuntimeError: except RuntimeError:
parser.exit(10, "Could not open display for plotting.\n") parser.exit(10, "Error: Could not open display for plotting.\n")
if args.range: if args.range:
try: try:
...@@ -259,7 +259,7 @@ def main(): ...@@ -259,7 +259,7 @@ def main():
m2=H.params['m2'], m2=H.params['m2'],
fom=metrics[range_func][0], fom=metrics[range_func][0],
unit=metrics[range_func][1] or '', unit=metrics[range_func][1] or '',
) )
else: else:
subtitle = None subtitle = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment