@@ -556,18 +556,32 @@ def _doctor_pages_deployment_detail(payload: dict[str, object]) -> tuple[str, do
556556 return ("pages_latest_deployment_valid" , "skipped" , "latest Pages status was not reported" )
557557
558558
559+ def _diagnose_dashboard_artifact_for_doctor (
560+ config : RuntimeConfig ,
561+ key_checks : list [tuple [str , str ]],
562+ ) -> doctor_mod .DashboardDoctorResult :
563+ try :
564+ return doctor_mod .diagnose_dashboard_artifact (
565+ config .pages_index_path ,
566+ configured_data_mode = config .resolved_data_mode ,
567+ secrets = key_checks ,
568+ retained_data_dir = config .data_dir ,
569+ )
570+ except doctor_mod ._DashboardDoctorError as exc :
571+ raise ActionError (f"Doctor diagnostics failed at stage { exc .stage } : { exc .detail } " ) from None
572+ except Exception as exc :
573+ raise ActionError (
574+ f"Doctor diagnostics failed unexpectedly ({ exc .__class__ .__name__ } )."
575+ ) from None
576+
577+
559578def run_doctor (config : RuntimeConfig ) -> None :
560579 """Run read-only dashboard artifact diagnostics."""
561580 key_checks = [
562581 ("DASHBOARD_SECRET_DO_NOT_REPLACE" , config .dashboard_secret ),
563582 ("COMPARISON_SECRET" , config .comparison_secret ),
564583 ]
565- result = doctor_mod .diagnose_dashboard_artifact (
566- config .pages_index_path ,
567- configured_data_mode = config .resolved_data_mode ,
568- secrets = key_checks ,
569- retained_data_dir = config .data_dir ,
570- )
584+ result = _diagnose_dashboard_artifact_for_doctor (config , key_checks )
571585 result .stages .extend (_doctor_pages_preflight_stages (config ))
572586 report_path = Path (".reponomics" ) / "doctor" / "doctor-report.json"
573587 report_path .parent .mkdir (parents = True , exist_ok = True )
0 commit comments