Browse Source

Replace str(exc) with exc.message to make CodeQL happy

pull/555/head
Pēteris Caune 3 years ago
parent
commit
3901a2825b
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      hc/api/views.py

+ 4
- 3
hc/api/views.py View File

@ -25,7 +25,8 @@ from hc.lib.badges import check_signature, get_badge_svg
class BadChannelException(Exception):
pass
def __init__(self, message):
self.message = message
@csrf_exempt
@ -195,7 +196,7 @@ def create_check(request):
try:
_update(check, request.json)
except BadChannelException as e:
return JsonResponse({"error": str(e)}, status=400)
return JsonResponse({"error": e.message}, status=400)
return JsonResponse(check.to_dict(), status=201 if created else 200)
@ -249,7 +250,7 @@ def update_check(request, code):
try:
_update(check, request.json)
except BadChannelException as e:
return JsonResponse({"error": str(e)}, status=400)
return JsonResponse({"error": e.message}, status=400)
return JsonResponse(check.to_dict())


Loading…
Cancel
Save