[oe] [PATCH] Add error handling to stage-manager

Mickaël Chazaux mchazaux at adeneo-embedded.com
Fri Apr 23 12:42:38 UTC 2010


	Add an error message telling the cause of the crash to the user.
---
 recipes/stage-manager/files/stage-manager |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/recipes/stage-manager/files/stage-manager b/recipes/stage-manager/files/stage-manager
index 536d1af..a2ecebe 100755
--- a/recipes/stage-manager/files/stage-manager
+++ b/recipes/stage-manager/files/stage-manager
@@ -29,11 +29,15 @@ def read_cache(cachefile):
     lines = f.readlines()
     f.close()
     for l in lines:
-        data = l.split('|')
-        cache[data[0]] = {}
-        cache[data[0]]['ts'] = int(data[1])
-        cache[data[0]]['size'] = int(data[2])
-        cache[data[0]]['seen'] = False
+	try:
+            data = l.split('|')
+            cache[data[0]] = {}
+            cache[data[0]]['ts'] = int(data[1])
+            cache[data[0]]['size'] = int(data[2])
+            cache[data[0]]['seen'] = False
+	except IndexError, e:
+            print("Corrupted line in cachefile " + cachefile + " : " + l)
+	    raise e
     return cache
 
 def mkdirhier(dir):
-- 
1.6.3.3





More information about the Openembedded-devel mailing list