Commit 3e3ce1e3 authored by Michal Čihař's avatar Michal Čihař

Better reporting of errors

parent d956c534
...@@ -595,11 +595,17 @@ class SubProject(models.Model): ...@@ -595,11 +595,17 @@ class SubProject(models.Model):
except ValueError: except ValueError:
notrecognized.append(match) notrecognized.append(match)
except Exception, e: except Exception, e:
errors.append(str(e)) errors.append('%s: %s' % (match, str(e)))
if len(notrecognized) > 0: if len(notrecognized) > 0:
raise ValidationError(_('Format of %d matched files could not be recognized.') % len(notrecognized)) raise ValidationError( '%s\n%s' % (
(_('Format of %d matched files could not be recognized.') % len(notrecognized)),
'\n'.join(notrecognized)
))
if len(errors) > 0: if len(errors) > 0:
raise ValidationError(_('Failed to parse %d matched files!') % len(errors)) raise ValidationError('%s\n%s' % (
(_('Failed to parse %d matched files!') % len(errors)),
'\n'.join(errors)
))
# Validate template # Validate template
if self.template != '': if self.template != '':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment