[Toaster] [PATCH] toaster: fix unhandled exception
Ed Bartosh
ed.bartosh at linux.intel.com
Wed Jul 27 05:15:02 PDT 2016
manage.py lsupdates throws DataError exception if the recipe can't be
saved to the MySQL database:
django.db.utils.DataError: (1406, "Data too long for column 'license' at row 1"
Adding DataError exception to the list of exceptions should make
lsupdates to print a warning message and skip the recipe.
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
bitbake/lib/toaster/orm/models.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index caacc2a..0d78ef5 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -21,7 +21,7 @@
from __future__ import unicode_literals
-from django.db import models, IntegrityError
+from django.db import models, IntegrityError, DataError
from django.db.models import F, Q, Sum, Count
from django.utils import timezone
from django.utils.encoding import force_bytes
@@ -78,7 +78,7 @@ if 'sqlite' in settings.DATABASES['default']['ENGINE']:
try:
obj = self.create(**params)
return obj, True
- except IntegrityError:
+ except (IntegrityError, DataError):
exc_info = sys.exc_info()
try:
return self.get(**lookup), False
--
2.6.6
More information about the toaster
mailing list