3535from easybuild .tools .github import GITHUB_API_URL , HTTP_STATUS_OK , GITHUB_EASYCONFIGS_REPO , GITHUB_EASYBLOCKS_REPO
3636from easybuild .tools .github import GITHUB_EB_MAIN , fetch_github_token
3737from easybuild .tools .options import EasyBuildOptions
38- from easybuild .tools .py2vs3 import HTTPError
38+ from easybuild .tools .py2vs3 import HTTPError , URLError
3939
4040HTTP_DELETE_OK = 204
4141
@@ -115,7 +115,7 @@ def main():
115115 if go .options .all :
116116 delete_gist = True
117117 elif not pr_nrs_matches :
118- log .info ("Found Easybuild test report without PR (id=%s)." , gist ["id" ])
118+ log .debug ("Found Easybuild test report without PR (id=%s)." , gist ["id" ])
119119 delete_gist = go .options .orphans
120120 elif go .options .closed_pr :
121121 # All PRs must be closed
@@ -140,11 +140,11 @@ def main():
140140 pr_cache [cache_key ] = pr ["state" ]
141141
142142 if pr_cache [cache_key ] == "closed" :
143- log .info ("Found report from closed %s PR #%s (id=%s)" , repo , pr_num , gist ["id" ])
143+ log .debug ("Found report from closed %s PR #%s (id=%s)" , repo , pr_num , gist ["id" ])
144144 elif delete_gist :
145145 if len (pr_nrs_matches ) > 1 :
146- log .info ("Found at least 1 PR, that is not closed yet: %s/%s (id=%s)" ,
147- repo , pr_num , gist ["id" ])
146+ log .debug ("Found at least 1 PR, that is not closed yet: %s/%s (id=%s)" ,
147+ repo , pr_num , gist ["id" ])
148148 delete_gist = False
149149 else :
150150 delete_gist = True
@@ -154,7 +154,12 @@ def main():
154154 log .info ("DRY-RUN: Delete gist with id=%s" , gist ["id" ])
155155 num_deleted += 1
156156 continue
157- status , del_gist = gh .gists [gist ["id" ]].delete ()
157+ try :
158+ status , del_gist = gh .gists [gist ["id" ]].delete ()
159+ except HTTPError as e :
160+ status , del_gist = e .code , e .msg
161+ except URLError as e :
162+ status , del_gist = None , e .reason
158163
159164 if status != HTTP_DELETE_OK :
160165 log .warning ("Unable to remove gist (id=%s): error code %s, message = %s" ,
0 commit comments