diff options
author | Aníbal Limón <anibal.limon@linux.intel.com> | 2016-06-13 13:44:56 -0500 |
---|---|---|
committer | Michael Wood <michael.g.wood@intel.com> | 2016-06-23 12:24:07 +0100 |
commit | a03225118e4b554bbe77327b8639bb03a9b7f6d6 (patch) | |
tree | 70d17d1725b89d88033079dff6f9281cf12e476a | |
parent | f402c8ad58a1675a680887e31fef15f7a2ad296e (diff) | |
download | error-report-web-a03225118e4b554bbe77327b8639bb03a9b7f6d6.tar.gz error-report-web-a03225118e4b554bbe77327b8639bb03a9b7f6d6.tar.bz2 error-report-web-a03225118e4b554bbe77327b8639bb03a9b7f6d6.zip |
parser: Add support for receive/store error_type.
For compatibility reasons if error_type isn't specified in the JSON
payload use 'Recipe' error by default.
[YOCTO #7584]
Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
-rw-r--r-- | Post/parser.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Post/parser.py b/Post/parser.py index 599afde..9639308 100644 --- a/Post/parser.py +++ b/Post/parser.py @@ -8,7 +8,7 @@ # Licensed under the MIT license, see COPYING.MIT for details import json, re -from Post.models import Build, BuildFailure +from Post.models import Build, BuildFailure, ErrorType from django.conf import settings from django.utils import timezone from django.core.urlresolvers import reverse @@ -52,6 +52,7 @@ class Parser: b.NAME = str(jsondata['username']) b.EMAIL = str(jsondata['email']) b.LINK_BACK = jsondata.get("link_back", None) + b.ERROR_TYPE = jsondata.get("error_type", ErrorType.RECIPE) # Extract the branch and commit g = re.match(r'(.*): (.*)', jsondata['branch_commit']) @@ -67,8 +68,8 @@ class Parser: b.save() failures = jsondata['failures'] - except: - return { 'error' : "Problem reading json payload" } + except Exception as e: + return { 'error' : "Problem reading json payload, %s" % e.message } for fail in failures: if len(fail) > int(settings.MAX_UPLOAD_SIZE): |