From 1c96ea9ab1ee8f1e8c36331510e3866aace74bcf Mon Sep 17 00:00:00 2001 From: Hossein Shafagh Date: Thu, 22 Oct 2020 17:10:32 -0700 Subject: [PATCH] better messaging of exceptions --- lemur/plugins/lemur_digicert/plugin.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lemur/plugins/lemur_digicert/plugin.py b/lemur/plugins/lemur_digicert/plugin.py index 574c8e8e..a100954f 100644 --- a/lemur/plugins/lemur_digicert/plugin.py +++ b/lemur/plugins/lemur_digicert/plugin.py @@ -221,10 +221,13 @@ def handle_cis_response(response): :param response: :return: """ - if response.status_code > 399: - raise Exception(response.text) - return response.json() + if response.status_code == 404: + raise Exception("DigiCert: Order not in issued state.") + elif response.status_code == 406: + raise Exception("DigiCert: Wrong Header") + elif response.status_code > 399: + raise Exception("DigiCert rejected request with the error:" + response.text) @retry(stop_max_attempt_number=10, wait_fixed=10000)