Skip to content

Commit

Permalink
Merge 0bc8e90 into 1878ace
Browse files Browse the repository at this point in the history
  • Loading branch information
wlodarcp authored May 19, 2020
2 parents 1878ace + 0bc8e90 commit 3f49067
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
11 changes: 8 additions & 3 deletions assets/report-generator/generate_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
template = Template(template_file.read())

with open(sys.argv[2], 'w') as result:
result.write(template.render(
validationResults = dredd_response["validationResults"]
))
try:
result.write(template.render(
validationResults = dredd_response["validationResults"]
))
except:
result.write(template.render(
errorMessage = dredd_response
))

else:
print('''Script requires two arguments - first is path to validation result json file, second is path to output html file -
Expand Down
12 changes: 10 additions & 2 deletions assets/report-generator/report_template.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,17 @@
{% endfor %}
</ul>
{% else %}
There were no interactions
{% if (errorMessage is defined)%}
<h1 style="color:red"> Error </h2>
<h3> Status: {{ errorMessage.status }} </h3>
<h3> Message: </h3>
<h3> {{ errorMessage.message }} </h2>
<h3> Path: {{ errorMessage.path}} </h3>
{% else %}
There were no interactions
{% endif %}
{% endif %}
</div>

</body>
</html>
</html>

0 comments on commit 3f49067

Please sign in to comment.