Skip to content

Commit

Permalink
Add contact info on error
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitamalinov committed Apr 26, 2024
1 parent 4bcd682 commit bcf1485
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
13 changes: 8 additions & 5 deletions services/github/github_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@
from services.supabase import SupabaseManager

from utils.file_manager import apply_patch
from utils.text_copy import request_issue_comment, request_limit_reached
from utils.text_copy import (
UPDATE_COMMENT_FOR_RAISED_ERRORS_BODY,
UPDATE_COMMENT_FOR_RAISED_ERRORS_NO_CHANGES_MADE,
request_issue_comment,
request_limit_reached,
)

from config import SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY

Expand Down Expand Up @@ -466,7 +471,7 @@ def update_comment_for_raised_errors(
error: Any, comment_url: str, unique_issue_id: str, token: str, which_function: str
) -> dict[str, Any]:
"""Update the comment on issue with an error message, set progress to 100, and raise the error."""
body = "Sorry, we have an error. Please try again."
body = UPDATE_COMMENT_FOR_RAISED_ERRORS_BODY
try:
if isinstance(error, requests.exceptions.HTTPError):
logging.error(
Expand Down Expand Up @@ -496,9 +501,7 @@ def update_comment_for_raised_errors(
)
)
):
body = (
"No changes were detected. Please add more details to the issue and try again.",
)
body = UPDATE_COMMENT_FOR_RAISED_ERRORS_NO_CHANGES_MADE
else:
logging.error(
"%s HTTP Error: %s - %s",
Expand Down
4 changes: 4 additions & 0 deletions utils/text_copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ def request_issue_comment(requests_left: int, end_date: datetime.datetime):
if requests_left == 1:
return f"\n\nYou have 1 request left in this cycle which refreshes on {end_date}.\nIf you have any questions or concerns, please contact us at [info@gitauto.ai](mailto:info@gitauto.ai)."
return f"\n\nYou have {requests_left} requests left in this cycle which refreshes on {end_date}.\nIf you have any questions or concerns, please contact us at [info@gitauto.ai](mailto:info@gitauto.ai)."


UPDATE_COMMENT_FOR_RAISED_ERRORS_BODY = "Sorry, we have an error. Please try again.\n\nHave feedback or need help?\n\n[info@gitauto.ai](mailto:info@gitauto.ai)"
UPDATE_COMMENT_FOR_RAISED_ERRORS_NO_CHANGES_MADE = "No changes were detected. Please add more details to the issue and try again.\n\nHave feedback or need help?\n\n[info@gitauto.ai](mailto:info@gitauto.ai)"

0 comments on commit bcf1485

Please sign in to comment.