Skip to content

Commit

Permalink
Issue #218: add error type
Browse files Browse the repository at this point in the history
  • Loading branch information
Francois-Werbrouck committed Nov 29, 2024
1 parent 8ba6ab4 commit ecdbccd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fertiscan/db/queries/organization/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,9 @@ def upsert_organization(cursor: Cursor, organization_info_id: UUID):
SELECT upsert_organization(%s);
"""
cursor.execute(query, (str(organization_info_id),))
return cursor.fetchone()[0]
if result := cursor.fetchone():
return result[0]
raise OrganizationUpdateError("Failed to update Organization. No data returned.")


@handle_query_errors(OrganizationRetrievalError)
Expand Down
1 change: 1 addition & 0 deletions tests/fertiscan/test_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def test_register_analysis(self):
ingredients = ingredient.get_ingredient_json(
self.cursor, str(analysis["product"]["label_id"])
)
self.assertIsNotNone(ingredients)
# print(ingredients)

# specifications = specification.get_all_specifications(
Expand Down

0 comments on commit ecdbccd

Please sign in to comment.