mirror of
https://github.com/qodo-ai/pr-agent.git
synced 2025-12-15 12:25:18 +00:00
fix: handle empty commits and errors in GitLab provider's get_latest_commit_url
This commit is contained in:
parent
c7f4b87d6f
commit
9a9acef0e8
1 changed files with 7 additions and 1 deletions
|
|
@ -181,7 +181,13 @@ class GitLabProvider(GitProvider):
|
||||||
get_logger().exception(f"Could not update merge request {self.id_mr} description: {e}")
|
get_logger().exception(f"Could not update merge request {self.id_mr} description: {e}")
|
||||||
|
|
||||||
def get_latest_commit_url(self):
|
def get_latest_commit_url(self):
|
||||||
return self.mr.commits().next().web_url
|
try:
|
||||||
|
return self.mr.commits().next().web_url
|
||||||
|
except StopIteration: # no commits
|
||||||
|
return ""
|
||||||
|
except Exception as e:
|
||||||
|
get_logger().exception(f"Could not get latest commit URL: {e}")
|
||||||
|
return ""
|
||||||
|
|
||||||
def get_comment_url(self, comment):
|
def get_comment_url(self, comment):
|
||||||
return f"{self.mr.web_url}#note_{comment.id}"
|
return f"{self.mr.web_url}#note_{comment.id}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue