From 58a27f2c1dd7eab1e340ade4ed85f19e2b50b823 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 23 Dec 2014 12:12:23 -0800 Subject: [PATCH] Better presentation of update failure / save --- commands/update_cmd.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/commands/update_cmd.py b/commands/update_cmd.py index 52a3fe59..d966a1cf 100644 --- a/commands/update_cmd.py +++ b/commands/update_cmd.py @@ -334,7 +334,12 @@ def editUpdate(tdb, cmdenv, stationID): tmpPath.unlink() tmpPath = None - finally: + except Exception as e: + print("ERROR:", e) + print() + print("*** YOUR UPDATES WILL BE SAVED AS {} ***".format( + "prices.last" + )) # Save a copy if absoluteFilename and tmpPath: saveTemporaryFile(tmpPath) @@ -357,12 +362,12 @@ def guidedUpdate(tdb, cmdenv): tmpPath = None except Exception as e: - print("*** ERROR ENCOUNTERED ***") + print("ERROR:", e) + print() print("*** YOUR UPDATES WILL BE SAVED AS {} ***".format( "prices.last" )) - raise - finally: + if tmpPath: saveTemporaryFile(tmpPath)