2020 STATUS_IN_PROGRESS ,
2121 STATUS_OK ,
2222 capture_checkin ,
23+ capture_exception ,
2324 init_sentry ,
2425)
2526
@@ -89,7 +90,9 @@ def get_repository_advisories(
8990 # 404 means no advisories or no access - that's okay
9091 if e .response .status_code == 404 :
9192 return
92- raise
93+ # Capture the original exception in Sentry (private)
94+ # and emit a sanitized public exception.
95+ capture_exception ()
9396
9497
9598def github_client_request (client : typing .Any , method : str , url : str , params : dict [str , str | int ]) -> typing .Any :
@@ -161,9 +164,11 @@ def apply_to_repo(github: GitHub, owner: str, repo: str, cve_api: CveApi) -> Non
161164 repo = repo ,
162165 ghsa_id = ghsa_id ,
163166 )
164- except RequestFailed as e :
165- print (f" ⚠️ Error creating private fork: { e .response .json ()} " )
166- raise e
167+ except RequestFailed :
168+ # Capture the original exception in Sentry (private)
169+ # and emit a sanitized public exception.
170+ capture_exception ()
171+ raise RuntimeError ("Request to create a private fork failed" ) from None
167172
168173 # Advisories that are in the 'draft' state without a CVE ID
169174 # should have one allocated by the PSF CVE Numbering Authority.
@@ -187,9 +192,11 @@ def apply_to_repo(github: GitHub, owner: str, repo: str, cve_api: CveApi) -> Non
187192 ghsa_id = ghsa_id ,
188193 data = patch_data ,
189194 )
190- except RequestFailed as e :
191- print (f" ⚠️ Error updating advisory: { e .response .json ()} " )
192- raise e
195+ except RequestFailed :
196+ # Capture the original exception in Sentry (private)
197+ # and emit a sanitized public exception.
198+ capture_exception ()
199+ raise RuntimeError ("Request to update advisory failed" ) from None
193200 print (" 💾 Updated advisory" )
194201 else :
195202 print (" ⏭️ No updates needed" )
0 commit comments