Skip to content

Commit

Permalink
implement refresh feature for 2 section in repo details page
Browse files Browse the repository at this point in the history
  • Loading branch information
JisanAR03 committed Jan 2, 2025
1 parent 73653db commit 39a21f7
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions website/views/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -1007,11 +1007,18 @@ def get_issue_count(full_name, query, headers):
)

except requests.RequestException as e:
return JsonResponse({"status": "error", "message": f"Network error: {str(e)}"}, status=503)
return JsonResponse(
{"status": "error", "message": "Network error: A network error occurred. Please try again later."}, status=503
)
except requests.HTTPError as e:
return JsonResponse({"status": "error", "message": f"GitHub API error: {str(e)}"}, status=e.response.status_code)
return JsonResponse(
{"status": "error", "message": "A GitHub API error occurred. Please try again later."},
status=e.response.status_code,
)
except ValueError as e:
return JsonResponse({"status": "error", "message": f"Data parsing error: {str(e)}"}, status=400)
return JsonResponse(
{"status": "error", "message": "There was an error processing your data."}, status=400
)

elif section == "metrics":
try:
Expand Down Expand Up @@ -1119,10 +1126,17 @@ def get_issue_count(full_name, query, headers):
)

except requests.RequestException as e:
return JsonResponse({"status": "error", "message": f"Network error: {str(e)}"}, status=503)
return JsonResponse(
{"status": "error", "message": "Network error: A network error occurred. Please try again later."}, status=503
)
except requests.HTTPError as e:
return JsonResponse({"status": "error", "message": f"GitHub API error: {str(e)}"}, status=e.response.status_code)
return JsonResponse(
{"status": "error", "message": "A GitHub API error occurred. Please try again later."},
status=e.response.status_code,
)
except ValueError as e:
return JsonResponse({"status": "error", "message": f"Data parsing error: {str(e)}"}, status=400)
return JsonResponse(
{"status": "error", "message": "There was an error processing your data."}, status=400
)

return super().post(request, *args, **kwargs)

0 comments on commit 39a21f7

Please sign in to comment.