Skip to content

Commit

Permalink
umweltprofis_at imporve error message on connection_error
Browse files Browse the repository at this point in the history
  • Loading branch information
5ila5 committed Nov 29, 2024
1 parent 4f93cc9 commit 323a019
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ def fetch(self):
return self.fetch_xml()

def fetch_ics(self):
r = requests.get(self._url)
try:
r = requests.get(self._url)
except requests.exceptions.ConnectionError as e:
raise Exception("Could not establish connection to the server") from e
r.raise_for_status()

fixed_text = r.text.replace(
Expand All @@ -75,7 +78,11 @@ def fetch_ics(self):
return entries

def fetch_xml(self):
r = requests.get(self._xmlurl)
try:
r = requests.get(self._xmlurl)
except requests.exceptions.ConnectionError as e:
raise Exception("Could not establish connection to the server") from e

r.raise_for_status()

doc = parseString(r.text)
Expand Down

0 comments on commit 323a019

Please sign in to comment.