From fe9afb826d267900800acc0dcddb6ebcd22b48e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9sar=20P=C3=A9rez?= Date: Sat, 7 Jun 2025 21:09:38 +0200 Subject: [PATCH] Fixed comment 3 --- pr_agent/git_providers/gitlab_provider.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pr_agent/git_providers/gitlab_provider.py b/pr_agent/git_providers/gitlab_provider.py index bcd6616b..8368984b 100644 --- a/pr_agent/git_providers/gitlab_provider.py +++ b/pr_agent/git_providers/gitlab_provider.py @@ -6,7 +6,7 @@ from urllib.parse import urlparse, parse_qs import gitlab import requests -from gitlab import GitlabGetError +from gitlab import GitlabGetError, GitlabAuthenticationError, GitlabCreateError, GitlabUpdateError from pr_agent.algo.types import EDIT_TYPE, FilePatchInfo @@ -155,8 +155,14 @@ class GitLabProvider(GitProvider): 'commit_message': message }) get_logger().debug(f"Created file {file_path} in branch {branch}") + except GitlabAuthenticationError as e: + get_logger().error(f"Authentication failed while creating/updating file {file_path} in branch {branch}: {e}") + raise + except (GitlabCreateError, GitlabUpdateError) as e: + get_logger().error(f"Permission denied or validation error for file {file_path} in branch {branch}: {e}") + raise except Exception as e: - get_logger().exception(f"Failed to create or update file {file_path} in branch {branch}: {e}") + get_logger().exception(f"Unexpected error creating/updating file {file_path} in branch {branch}: {e}") raise def get_diff_files(self) -> list[FilePatchInfo]: