]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: fix unhandled exception
authorEd Bartosh <ed.bartosh@linux.intel.com>
Wed, 27 Jul 2016 12:15:02 +0000 (15:15 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 10 Aug 2016 23:08:18 +0000 (00:08 +0100)
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@linux.intel.com>
lib/toaster/orm/models.py

index 3da9a66d0c4761938d325e8ea0a473809e4012bf..1c9f3a93639e5149f30cccffc93ca6a4bb7e66b9 100644 (file)
@@ -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