Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong "raise" statements in state.py #764

Closed
gbregman opened this issue Jul 23, 2024 · 0 comments · Fixed by #762
Closed

Wrong "raise" statements in state.py #764

gbregman opened this issue Jul 23, 2024 · 0 comments · Fixed by #762
Assignees

Comments

@gbregman
Copy link
Contributor

We have a few wrong "raise" statement in control/state.py. They have no exception parameter which is only valid when we are in except clause with an active exception:

diff --git a/control/state.py b/control/state.py
index e76fa4d..db93e49 100644
--- a/control/state.py
+++ b/control/state.py
@@ -456,7 +456,7 @@ class OmapGatewayState(GatewayState):
     def _add_key(self, key: str, val: str):
         """Adds key and value to the OMAP."""
         if not self.ioctx:
-            raise
+            raise RuntimeError("Can't add key when Rados is closed")

         try:
             version_update = self.version + 1
@@ -483,7 +483,7 @@ class OmapGatewayState(GatewayState):
     def _remove_key(self, key: str):
         """Removes key from the OMAP."""
         if not self.ioctx:
-            raise
+            raise RuntimeError("Can't remove key when Rados is closed")

         try:
             version_update = self.version + 1
@@ -510,7 +510,7 @@ class OmapGatewayState(GatewayState):
     def delete_state(self):
         """Deletes OMAP object contents."""
         if not self.ioctx:
-            raise
+            raise RuntimeError("Can't delete state when Rados is closed")

         try:
             with rados.WriteOpCtx() as write_op:
@gbregman gbregman self-assigned this Jul 23, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in NVMe-oF Jul 23, 2024
@gbregman gbregman changed the title Wrong "raise" statement in state.py Wrong "raise" statements in state.py Jul 23, 2024
@gbregman gbregman linked a pull request Jul 23, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in NVMe-oF Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant