From 6745d85e8fffce336e1909b87b07edc438734142 Mon Sep 17 00:00:00 2001 From: Alarig Le Lay Date: Mon, 29 Jul 2024 00:04:27 +0200 Subject: [PATCH] Add a catch case for HTTP 400 error Signed-off-by: Alarig Le Lay --- check_domain_expiration_rdap.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/check_domain_expiration_rdap.py b/check_domain_expiration_rdap.py index 933adad..52e5962 100755 --- a/check_domain_expiration_rdap.py +++ b/check_domain_expiration_rdap.py @@ -64,6 +64,10 @@ def parse_ldap(domain, rdap_server): req_rdap = requests.get(f'{rdap_server}domain/{domain}') match req_rdap.status_code: + case 400: + raise nagiosplugin.CheckError( + f'Got {req_rdap.status_code}, the RDAP server {rdap_server} interprets this domain query as a bad request' + ) case 403: raise nagiosplugin.CheckError( f'Got {req_rdap.status_code}, the RDAP server {rdap_server} refused to reply'