From f0cb9cf5a4f9de2a78a6a1ad84c32947aadf8707 Mon Sep 17 00:00:00 2001 From: Worros Date: Tue, 9 Nov 2010 13:45:27 +0800 Subject: [PATCH] Absolute: Update some error handling Fix so log file and stdout both get a descriptive error message --- pyfpdb/AbsoluteToFpdb.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyfpdb/AbsoluteToFpdb.py b/pyfpdb/AbsoluteToFpdb.py index c30f4544..5aebab4a 100755 --- a/pyfpdb/AbsoluteToFpdb.py +++ b/pyfpdb/AbsoluteToFpdb.py @@ -193,11 +193,14 @@ class Absolute(HandHistoryConverter): if m is None or fname_info is None: if m is None: - logging.error(_("Didn't match re_HandInfo")) - logging.error(hand.handText) + tmp = hand.handText[0:100] + logging.error(_("readHandInfo: Didn't match: '%s'") % tmp) + raise FpdbParseError(_("Absolute: Didn't match re_HandInfo: '%s'") % tmp) elif fname_info is None: - logging.info(_("File name didn't match re_*InfoFromFilename")) - logging.info(_("File name: %s") % self.in_path) + logging.error(_("readHandInfo: File name didn't match re_*InfoFromFilename")) + logging.error(_("File name: %s") % self.in_path) + raise FpdbParseError(_("Absolute: Didn't match re_*InfoFromFilename: '%s'") % self.in_path) + logging.debug("HID %s, Table %s" % (m.group('HID'), m.group('TABLE'))) hand.handid = m.group('HID') if m.group('TABLE'):