From 2d3c405177ca8fb9848f4b5c9193b670984770a8 Mon Sep 17 00:00:00 2001 From: Martijn Vermaat <martijn@vermaat.name> Date: Thu, 28 Aug 2014 16:31:38 +0200 Subject: [PATCH] More useful assertion errors in Mutalyzer monitor --- extras/monitor/mutalyzer-monitor.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extras/monitor/mutalyzer-monitor.py b/extras/monitor/mutalyzer-monitor.py index 5aaadc38..9730604a 100755 --- a/extras/monitor/mutalyzer-monitor.py +++ b/extras/monitor/mutalyzer-monitor.py @@ -19,6 +19,7 @@ import argparse import logging import sys import time +import traceback import urllib2 from suds import WebFault @@ -40,6 +41,12 @@ def main(mutalyzer_url): checks = check_website, check_soap, check_batch try: [check(mutalyzer_url) for check in checks] + except AssertionError: + _, _, tb = sys.exc_info() + filename, line, function, text = traceback.extract_tb(tb)[-1] + sys.stderr.write('Failed: %s (line %d)\n' % + (text, line)) + sys.exit(1) except BaseException as e: sys.stderr.write(str(e) + '\n') sys.exit(1) -- GitLab