Add a catch case for HTTP 400 error

Signed-off-by: Alarig Le Lay <alarig@swordarmor.fr>
This commit is contained in:
Alarig Le Lay 2024-07-29 00:04:27 +02:00
parent cab6e738aa
commit 6745d85e8f
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC

View file

@ -64,6 +64,10 @@ def parse_ldap(domain, rdap_server):
req_rdap = requests.get(f'{rdap_server}domain/{domain}') req_rdap = requests.get(f'{rdap_server}domain/{domain}')
match req_rdap.status_code: 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: case 403:
raise nagiosplugin.CheckError( raise nagiosplugin.CheckError(
f'Got {req_rdap.status_code}, the RDAP server {rdap_server} refused to reply' f'Got {req_rdap.status_code}, the RDAP server {rdap_server} refused to reply'