[IMP] more comprehensive error message

This commit is contained in:
unknown
2013-11-01 11:54:13 +01:00
parent 19867c5119
commit 43127e7b65

View File

@@ -140,7 +140,12 @@ class move_line_importer(orm.Model):
:returns: (head [list of first row], data [list of list])
"""
data = csv.reader(csv_file, delimiter=str(delimiter))
try:
data = csv.reader(csv_file, delimiter=str(delimiter))
except csv.Error as error:
raise orm.except_orm(_('CSV file is malformed'),
_("Maybe you have not choose correct separator \n"
"the error detail is : \n %s") % repr(error))
head = data.next()
head = [x.replace(' ', '') for x in head]
# Generator does not work with orm.BaseModel.load