From cb9c2da669c2e335e0a71e4c2fdea0507fea85f6 Mon Sep 17 00:00:00 2001 From: Sunny Sun <38218185+sunnyosun@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:27:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20Raise=20error=20if=20organism=20?= =?UTF-8?q?can't=20be=20created=20from=20bionty=20(#167)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bionty/_bionty.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bionty/_bionty.py b/bionty/_bionty.py index b6e1322..fc8c015 100644 --- a/bionty/_bionty.py +++ b/bionty/_bionty.py @@ -45,6 +45,10 @@ def create_or_get_organism_record( try: # create a organism record from bionty reference organism_record = Organism.from_source(name=organism) + if organism_record is None: + raise ValueError( + f"Organism {organism} can't be created from the bionty reference, check your spelling or create it manually." + ) # link the organism record to the default bionty source organism_record.source = get_source_record( bt_base.Organism(), Organism