8000 fix: ValueError should be raised, not returned · IdentityPython/pyop@58a7c15 · GitHub
[go: up one dir, main page]

Skip to content

Commit 58a7c15

Browse files
fix: ValueError should be raised, not returned
Fix an issue where invalid config might lead to an ValueError object being used as a databasse object, leading to application errors later. Rather fail fast by properly raising the exception.
1 parent 837045e commit 58a7c15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/pyop/storage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def from_uri(cls, db_uri, collection, db_name=None, ttl=None, **kwargs):
9393
alg=alg
9494
)
9595

96-
return ValueError(f"Invalid DB URI: {db_uri}")
96+
raise ValueError(f"Invalid DB URI: {db_uri}")
9797

9898
@classmethod
9999
def type(cls, db_uri):
@@ -105,7 +105,7 @@ def type(cls, db_uri):
105105
elif url.scheme == "stateless":
106106
return "stateless"
107107

108-
return ValueError(f"Invalid DB URI: {db_uri}")
108+
raise ValueError(f"Invalid DB URI: {db_uri}")
109109

110110
@property
111111
def ttl(self):

0 commit comments

Comments
 (0)
0