Skip to content

Commit

Permalink
frontend: return empty dict instead of null in API calls to BE
Browse files Browse the repository at this point in the history
get_build_record and get_srpm_build_record methods returns
None in case of exception or empty task which results in
null response in API endpoints. Backend worker
don't expect null value, tries to unpack it and fails
  • Loading branch information
nikromen committed Aug 8, 2023
1 parent 030dd32 commit 8124eed
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ def get_build_task(task_id):
try:
task = BuildsLogic.get_build_task(task_id)
build_record = get_build_record(task)
if build_record is None:
build_record = {}

return flask.jsonify(build_record)
except CoprHttpException as ex:
jsonout = flask.jsonify({"msg": str(ex)})
Expand All @@ -370,6 +373,9 @@ def get_srpm_build_task(build_id):
jsonout.status_code = 404
return jsonout
build_record = get_srpm_build_record(task)
if build_record is None:
build_record = {}

return flask.jsonify(build_record)


Expand Down

0 comments on commit 8124eed

Please sign in to comment.