forked from enviPath/enviPy
[Fix] Catch Exception for Adding Structures / Show PubChem Substances (#168)
Fixes #163 Fixes #165 Co-authored-by: Tim Lorsbach <tim@lorsba.ch> Reviewed-on: enviPath/enviPy#168
This commit is contained in:
@ -1251,7 +1251,16 @@ def package_compound_structures(request, package_uuid, compound_uuid):
|
||||
structure_smiles = request.POST.get("structure-smiles")
|
||||
structure_description = request.POST.get("structure-description")
|
||||
|
||||
cs = current_compound.add_structure(structure_smiles, structure_name, structure_description)
|
||||
try:
|
||||
cs = current_compound.add_structure(
|
||||
structure_smiles, structure_name, structure_description
|
||||
)
|
||||
except ValueError:
|
||||
return error(
|
||||
request,
|
||||
"Adding structure failed!",
|
||||
"The structure could not be added as normalized structures don't match!",
|
||||
)
|
||||
|
||||
return redirect(cs.url)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user