Skip to content

Commit de5099f

Browse files
Replace remaining broad exception handlers with specific types
Co-authored-by: codingwithnsh <138281862+codingwithnsh@users.noreply.github.com>
1 parent c6d1169 commit de5099f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sandbox_manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def start(self):
7777
self.stats['last_started'] = datetime.now().isoformat()
7878
self.save_config()
7979
return True
80-
except Exception as e:
80+
except (OSError, IOError) as e:
8181
print(f"Error starting sandbox: {e}")
8282
return False
8383

@@ -104,7 +104,7 @@ def stop(self):
104104
self.status = "stopped"
105105
self.save_config()
106106
return True
107-
except Exception as e:
107+
except (OSError, IOError, ProcessLookupError) as e:
108108
print(f"Error stopping sandbox: {e}")
109109
return False
110110

@@ -124,7 +124,7 @@ def pause(self):
124124
self.status = "paused"
125125
self.save_config()
126126
return True
127-
except Exception as e:
127+
except (OSError, IOError) as e:
128128
print(f"Error pausing sandbox: {e}")
129129
return False
130130

@@ -144,7 +144,7 @@ def resume(self):
144144
self.status = "running"
145145
self.save_config()
146146
return True
147-
except Exception as e:
147+
except (OSError, IOError) as e:
148148
print(f"Error resuming sandbox: {e}")
149149
return False
150150

0 commit comments

Comments
 (0)