Skip to content

Commit 31a1752

Browse files
authored
fix: replace 14 bare excepts with except Exception
fix: replace 14 bare excepts with except Exception
2 parents 6c41297 + 823fb36 commit 31a1752

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

sdk/nexent/core/agents/core_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def __call__(self, task: str, **kwargs):
399399
try:
400400
self.observer.add_message(
401401
self.name, ProcessType.AGENT_FINISH, str(report))
402-
except:
402+
except Exception:
403403
self.observer.add_message(self.name, ProcessType.AGENT_FINISH, "")
404404

405405
answer = Template(self.prompt_templates["managed_agent"]["report"], undefined=StrictUndefined).render({

sdk/nexent/core/models/stt_model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ async def process_streaming_audio(self, ws_client, segment_size: int):
503503
try:
504504
await ws_client.send_json({"error": f"STT service error: {str(e)}"})
505505
client_connected = False
506-
except:
506+
except Exception:
507507
pass
508508
break
509509

@@ -515,7 +515,7 @@ async def process_streaming_audio(self, ws_client, segment_size: int):
515515
try:
516516
result_text = result['payload_msg']['result']['text'] if result['payload_msg']['result'][
517517
'text'] else "empty"
518-
except:
518+
except Exception:
519519
logger.error(f"Malformed result: {result}")
520520
logger.info(f"Received response: {result_text}")
521521

@@ -550,7 +550,7 @@ async def process_streaming_audio(self, ws_client, segment_size: int):
550550
try:
551551
await ws_client.send_json({"error": f"STT service connection closed unexpectedly: {e}"})
552552
client_connected = False
553-
except:
553+
except Exception:
554554
pass
555555
break
556556

@@ -572,7 +572,7 @@ async def process_streaming_audio(self, ws_client, segment_size: int):
572572
if client_connected:
573573
try:
574574
await ws_client.send_json({"error": error_msg})
575-
except:
575+
except Exception:
576576
logger.error("Cannot send error message: client disconnected")
577577

578578
except websockets.exceptions.WebSocketException as e:
@@ -581,7 +581,7 @@ async def process_streaming_audio(self, ws_client, segment_size: int):
581581
if client_connected:
582582
try:
583583
await ws_client.send_json({"error": error_msg})
584-
except:
584+
except Exception:
585585
logger.error("Cannot send error message: client disconnected")
586586

587587
except Exception as e:
@@ -592,7 +592,7 @@ async def process_streaming_audio(self, ws_client, segment_size: int):
592592
if client_connected:
593593
try:
594594
await ws_client.send_json({"error": error_msg})
595-
except:
595+
except Exception:
596596
logger.error("Cannot send error message: client disconnected")
597597

598598
finally:

sdk/nexent/core/tools/terminal_tool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def _is_session_alive(self, session: Dict[str, Any]) -> bool:
173173
return True
174174

175175
return False
176-
except:
176+
except Exception:
177177
return False
178178

179179
def _cleanup_session(self, session: Dict[str, Any]):
@@ -187,7 +187,7 @@ def _cleanup_session(self, session: Dict[str, Any]):
187187
session["channel"].close()
188188
if session and "client" in session:
189189
session["client"].close()
190-
except:
190+
except Exception:
191191
pass
192192

193193
def _clean_output(self, raw_output: str, command: str) -> str:

sdk/nexent/core/utils/favicon_extractor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def check_favicon_exists(url):
3232
try:
3333
response = requests.head(url, timeout=3, allow_redirects=True)
3434
return response.status_code == 200
35-
except:
35+
except Exception:
3636
return False
3737

3838

test/backend/services/test_mcp_container_service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ async def test_load_image_from_tar_file_success_with_tags(self, mock_manager):
11041104
# Clean up
11051105
try:
11061106
os.unlink(temp_file_path)
1107-
except:
1107+
except Exception:
11081108
pass
11091109

11101110
@pytest.mark.asyncio
@@ -1130,7 +1130,7 @@ async def test_load_image_from_tar_file_success_without_tags(self, mock_manager)
11301130
# Clean up
11311131
try:
11321132
os.unlink(temp_file_path)
1133-
except:
1133+
except Exception:
11341134
pass
11351135

11361136
@pytest.mark.asyncio
@@ -1150,7 +1150,7 @@ async def test_load_image_from_tar_file_empty_images(self, mock_manager):
11501150
# Clean up
11511151
try:
11521152
os.unlink(temp_file_path)
1153-
except:
1153+
except Exception:
11541154
pass
11551155

11561156
@pytest.mark.asyncio
@@ -1171,7 +1171,7 @@ async def test_load_image_from_tar_file_exception(self, mock_manager):
11711171
# Clean up
11721172
try:
11731173
os.unlink(temp_file_path)
1174-
except:
1174+
except Exception:
11751175
pass
11761176

11771177

0 commit comments

Comments
 (0)