From d92024ce687903b6d1ac459523d9c8e58bb8f218 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Wed, 15 Dec 2021 23:27:40 +0100 Subject: [PATCH 1/2] feat: improve error handling with hint --- augur/refine.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/augur/refine.py b/augur/refine.py index f09bc8a00..d1adf77f3 100644 --- a/augur/refine.py +++ b/augur/refine.py @@ -242,7 +242,10 @@ def run(args): elif args.root in ['least-squares', 'min_dev', 'oldest']: raise TypeError("The rooting option '%s' is only available when inferring a timetree. Please specify an explicit outgroup."%args.root) else: - T.root_with_outgroup(args.root) + try: + T.root_with_outgroup(args.root) + except ValueError as err: + raise ValueError(f"{err}\nHINT: This error may be because your specified root with name '{args.root}' was not found in your alignment file") tt = TreeAnc(tree=T, aln=aln, ref=ref, gtr='JC69', verbose=1) From 3d1cbf809090ccea8129d58069d938023c74909f Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Thu, 16 Dec 2021 02:11:50 +0100 Subject: [PATCH 2/2] feat: use exception chaining --- augur/refine.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/augur/refine.py b/augur/refine.py index d1adf77f3..c86d2ce0a 100644 --- a/augur/refine.py +++ b/augur/refine.py @@ -245,7 +245,7 @@ def run(args): try: T.root_with_outgroup(args.root) except ValueError as err: - raise ValueError(f"{err}\nHINT: This error may be because your specified root with name '{args.root}' was not found in your alignment file") + raise ValueError(f"HINT: This error may be because your specified root with name '{args.root}' was not found in your alignment file") from err tt = TreeAnc(tree=T, aln=aln, ref=ref, gtr='JC69', verbose=1)