Better handle healthcheck errors
This commit is contained in:
parent
e870f4b162
commit
8c7f6b7f69
2 changed files with 10 additions and 4 deletions
|
@ -5,7 +5,10 @@ from .utils import _get_linguist_colours
|
||||||
|
|
||||||
class GitHubLinguistHealthCheckBackend(BaseHealthCheckBackend):
|
class GitHubLinguistHealthCheckBackend(BaseHealthCheckBackend):
|
||||||
def check_status(self) -> None:
|
def check_status(self) -> None:
|
||||||
colours = _get_linguist_colours()
|
try:
|
||||||
|
colours = _get_linguist_colours()
|
||||||
|
except Exception as e:
|
||||||
|
self.add_error(str(e))
|
||||||
|
|
||||||
if colours is None:
|
if colours is None:
|
||||||
self.add_error("No colours provided")
|
self.add_error("No colours provided")
|
||||||
|
|
|
@ -5,9 +5,12 @@ from health_check.backends import BaseHealthCheckBackend
|
||||||
|
|
||||||
class SpotifyHealthCheckBackend(BaseHealthCheckBackend):
|
class SpotifyHealthCheckBackend(BaseHealthCheckBackend):
|
||||||
def check_status(self) -> None:
|
def check_status(self) -> None:
|
||||||
requests.get(
|
try:
|
||||||
f"https://{settings.SPOTIFY_PROXY_HOST}/.health/"
|
requests.get(
|
||||||
).raise_for_status()
|
f"https://{settings.SPOTIFY_PROXY_HOST}/.health/"
|
||||||
|
).raise_for_status()
|
||||||
|
except Exception as e:
|
||||||
|
self.add_error(str(e))
|
||||||
|
|
||||||
def identifier(self) -> str:
|
def identifier(self) -> str:
|
||||||
return "Spotify Proxy"
|
return "Spotify Proxy"
|
||||||
|
|
Loading…
Reference in a new issue