Bugfixes for the library
* Make sure library returns a list of translated names
* Replace generic catch block to handle exceptions seperately
Bugfixes for insert_name.py
* Make errors more verbose when trying to insert duplicate names in the database
refs: #2840, #2839, #2838
Change-Id: I45e978856c9492ec8fb67ae00afc69265ab28d28
diff --git a/tools/insert_names.py b/tools/insert_names.py
index 88fadb3..3c3bb6f 100644
--- a/tools/insert_names.py
+++ b/tools/insert_names.py
@@ -91,7 +91,7 @@
print("Inserted record %s" %(name))
return True
except sql.Error as err:
- print("Error inserting name %s" %(err.msg))
+ print("Error inserting name %s, \nError:%s" %(name, err.msg))
return False
if __name__ == '__main__':
@@ -100,6 +100,10 @@
#do the translation, the library should provide error messages, if any
ndnNames = atmos_translator.argsForTranslation(datafilePath, configFilepath)
+ if ndnNames is False:
+ print("Error parsing config file, exiting")
+ sys.exit(-1)
+
if len(ndnNames) == 0:
print("No name returned from the translator, exiting.")
sys.exit(-1)