diff --git a/backend/consensus/worker_service.py b/backend/consensus/worker_service.py index a27487eb6..8bb0a16a9 100644 --- a/backend/consensus/worker_service.py +++ b/backend/consensus/worker_service.py @@ -494,7 +494,7 @@ def health_check(): "cpu_percent": round(process.cpu_percent(), 2), "memory_percent": round(process.memory_percent(), 2), } - except: + except (psutil.Error, OSError): pass # Probe local GenVM manager responsiveness. diff --git a/backend/database_handler/migration/versions/02aa0c34a463_validator_config_string_to_jsonb.py b/backend/database_handler/migration/versions/02aa0c34a463_validator_config_string_to_jsonb.py index 34692831e..af438c3e8 100644 --- a/backend/database_handler/migration/versions/02aa0c34a463_validator_config_string_to_jsonb.py +++ b/backend/database_handler/migration/versions/02aa0c34a463_validator_config_string_to_jsonb.py @@ -31,7 +31,7 @@ def transform(value): if isinstance(value, str): try: return json.loads(value) - except: + except (json.JSONDecodeError, TypeError): print(f"Failed to parse JSON: {value}. Removing configuration.") return {} print(f"Unexpected type: {type(value)}. Removing configuration.") diff --git a/backend/database_handler/transactions_processor.py b/backend/database_handler/transactions_processor.py index e27afb72f..8469b0915 100644 --- a/backend/database_handler/transactions_processor.py +++ b/backend/database_handler/transactions_processor.py @@ -900,7 +900,7 @@ def get_transaction_count(self, address: str) -> int: # Normalize address to checksum format try: checksum_address = self.web3.to_checksum_address(address) - except: + except (ValueError, TypeError): checksum_address = address # Always use database count as source of truth diff --git a/backend/node/create_nodes/providers.py b/backend/node/create_nodes/providers.py index 25f5cf47c..1b7ee0582 100644 --- a/backend/node/create_nodes/providers.py +++ b/backend/node/create_nodes/providers.py @@ -23,7 +23,7 @@ def is_ollama_available() -> bool: result = sock.connect_ex(("ollama", int(os.getenv("OLAMAPORT", "11434")))) sock.close() return result == 0 - except: + except (OSError, ValueError): return False diff --git a/backend/protocol_rpc/fastapi_endpoint_generator.py b/backend/protocol_rpc/fastapi_endpoint_generator.py index d1dbdd888..2ea8b8100 100644 --- a/backend/protocol_rpc/fastapi_endpoint_generator.py +++ b/backend/protocol_rpc/fastapi_endpoint_generator.py @@ -315,7 +315,7 @@ async def handle_method( if db and hasattr(db, "rollback"): try: db.rollback() - except: + except Exception: pass # Ignore rollback errors raise