Skip to content

Commit

Permalink
GenPollUrl: catch http.client exceptions
Browse files Browse the repository at this point in the history
This catches exceptions from the HTTP protocol client used in urllib
which can be raised in GenPollUrl.fetch.
  • Loading branch information
saviola777 authored and elParaguayo committed Sep 7, 2024
1 parent 52d920a commit a4ec8ec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libqtile/widget/generic_poll_text.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import subprocess
from http.client import HTTPException
from typing import Any
from urllib.error import URLError
from urllib.request import Request, urlopen
Expand Down Expand Up @@ -85,6 +86,8 @@ def poll(self):
body = self.fetch()
except URLError:
return "No network"
except HTTPException:
return "Request failed"

try:
text = self.parse(body)
Expand Down

0 comments on commit a4ec8ec

Please sign in to comment.