Skip to contentSkip to conversation

toaster: fix unhandled traceback

PATCH New Ed Bartosh 1 participant 1 message Jul 12, 2016

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 toaster: fix unhandled traceback

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.

---
 bitbake/lib/toaster/orm/models.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/toaster/orm/models.py +2 -2
index 61f6a20..4bbca24 100644
@@ -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, Avg, Max, Sum, Count
 from django.utils import timezone
 from django.utils.encoding import force_bytes
@@ -1469,7 +1469,7 @@ class LayerIndexLayerSource(LayerSource):
                 else: # workaround for old style layer index
                     ro.is_image = "-image-" in ri['pn']
                 ro.save()
-            except IntegrityError as e:
+            except (IntegrityError, DataError) as e:
                 logger.debug("Failed saving recipe, ignoring: %s (%s:%s)" % (e, ro.layer_version, ri['filepath']+"/"+ri['filename']))
                 ro.delete()
 
Signature · 1 line
2.1.4