diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-02 06:08:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-02 06:08:52 +0300 |
commit | 123582839259a70910bd0e9109e57ed65d71cb23 (patch) | |
tree | da3c33793182af05f67bf27e071168df94711376 /app/services/security | |
parent | a0e1fa9aada57f1fde912890e96f867ac540ab03 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/security')
-rw-r--r-- | app/services/security/ci_configuration/base_create_service.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/services/security/ci_configuration/base_create_service.rb b/app/services/security/ci_configuration/base_create_service.rb index 9c3cd6b25fb..a205a68532b 100644 --- a/app/services/security/ci_configuration/base_create_service.rb +++ b/app/services/security/ci_configuration/base_create_service.rb @@ -2,6 +2,8 @@ module Security module CiConfiguration + CiContentParseError = Class.new(StandardError) + class BaseCreateService attr_reader :branch_name, :current_user, :project, :name @@ -34,6 +36,10 @@ module Security track_event(attributes_for_commit) ServiceResponse.success(payload: { branch: branch_name, success_path: successful_change_path }) + rescue CiContentParseError => e + Gitlab::ErrorTracking.track_exception(e) + + ServiceResponse.error(message: e.message) rescue Gitlab::Git::PreReceiveError => e ServiceResponse.error(message: e.message) rescue StandardError @@ -59,12 +65,12 @@ module Security @gitlab_ci_yml ||= project.ci_config_for(root_ref) YAML.safe_load(@gitlab_ci_yml) if @gitlab_ci_yml rescue Psych::BadAlias - raise Gitlab::Graphql::Errors::MutationError, - _(".gitlab-ci.yml with aliases/anchors is not supported. Please change the CI configuration manually.") + raise CiContentParseError, _(".gitlab-ci.yml with aliases/anchors is not supported. " \ + "Please change the CI configuration manually.") rescue Psych::Exception => e Gitlab::AppLogger.error("Failed to process existing .gitlab-ci.yml: #{e.message}") - raise Gitlab::Graphql::Errors::MutationError, - "#{name} merge request creation mutation failed" + + raise CiContentParseError, "#{name} merge request creation failed" end def successful_change_path |