Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/terraform/state.rb')
-rw-r--r--lib/api/terraform/state.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/api/terraform/state.rb b/lib/api/terraform/state.rb
index f6dfbcafbb6..29e71611092 100644
--- a/lib/api/terraform/state.rb
+++ b/lib/api/terraform/state.rb
@@ -11,6 +11,13 @@ module API
default_format :json
+ rescue_from(
+ ::ActiveRecord::RecordNotUnique,
+ ::PG::UniqueViolation
+ ) do |e|
+ render_api_error!(e.message, 422)
+ end
+
before do
authenticate!
authorize! :read_terraform_state, user_project