Module: check_mk
Branch: master
Commit: 7b1419fb46ea13ca7100613fd000876d4edbaecc
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7b1419fb46ea13…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Apr 15 13:20:23 2016 +0200
mail: Improved error handling in case of graph fetching issues
---
notifications/mail | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/notifications/mail b/notifications/mail
index a664ccf..2fb5564 100755
--- a/notifications/mail
+++ b/notifications/mail
@@ -511,10 +511,19 @@ def render_cmk_graphs(context):
except Exception, e:
if opt_debug:
raise
- sys.stderr.write("ERROR: %s\n" % e)
+ sys.stderr.write("ERROR: Failed to fetch graphs: %s\n" % e)
return []
- return map(base64.b64decode, json.loads(json_data))
+ try:
+ base64_strings = json.loads(json_data)
+ except Exception, e:
+ if opt_debug:
+ raise
+ sys.stderr.write("ERROR: Failed to decode graphs: %s\nData: %s\n" %
+ (e, json_data))
+ return []
+
+ return map(base64.b64decode, base64_strings)
def get_omd_config(key):