Fix bare except patterns in coordinator-api
- Fixed monitoring_dashboard.py: replaced bare except with ValueError, AttributeError - Fixed cross_chain_bridge_enhanced.py: replaced bare except with Exception (with logging) - Fixed enterprise_integration.py: replaced bare except with specific exceptions This starts Phase 3: Exception Handling Improvement
This commit is contained in:
@@ -258,7 +258,7 @@ def calculate_overall_metrics(health_data: dict[str, Any]) -> dict[str, Any]:
|
||||
time_str = service_health["response_time"].replace("s", "")
|
||||
total_response_time += float(time_str)
|
||||
response_time_count += 1
|
||||
except:
|
||||
except (ValueError, AttributeError):
|
||||
pass
|
||||
|
||||
# Determine overall status
|
||||
|
||||
@@ -450,7 +450,9 @@ class CrossChainBridgeService:
|
||||
)
|
||||
self.session.execute(stmt)
|
||||
self.session.commit()
|
||||
except:
|
||||
except Exception:
|
||||
# Database update failed, log but continue
|
||||
logger.warning(f"Failed to update bridge request status to failed: {bridge_request_id}")
|
||||
pass
|
||||
|
||||
async def _execute_atomic_swap(self, bridge_request: BridgeRequest) -> None:
|
||||
|
||||
@@ -392,7 +392,7 @@ class SAPIntegration(ERPIntegration):
|
||||
day = date_value[6:8]
|
||||
return f"{year}-{month}-{day}"
|
||||
return date_value
|
||||
except:
|
||||
except (ValueError, IndexError, AttributeError, TypeError):
|
||||
return date_value
|
||||
|
||||
def _transform_numeric(self, value: str, transform: Dict[str, Any]) -> Union[str, int, float]:
|
||||
|
||||
Reference in New Issue
Block a user