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
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-07-25 02:46:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-07-25 02:46:54 +0300
commitdb353eb79a55a4035fd4553b8d82cfcfd93ecf46 (patch)
treea4818a185899210069458e21bbb62f0ce98d4aba /lib
parentae5079ea12a3ffc8d8b89db738a63fd2978b8e69 (diff)
Add latest changes from gitlab-org/gitlab@16-2-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab_settings/options.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/gitlab_settings/options.rb b/lib/gitlab_settings/options.rb
index 68555794436..3338c2d216b 100644
--- a/lib/gitlab_settings/options.rb
+++ b/lib/gitlab_settings/options.rb
@@ -123,7 +123,7 @@ module GitlabSettings
def stringify_keys!
error_msg = "Warning: Do not mutate #{self.class} objects: `#{__method__}`"
- Gitlab::ErrorTracking.track_and_raise_for_dev_exception(RuntimeError.new(error_msg), method: __method__)
+ log_and_raise_dev_exception(error_msg, method: __method__)
to_hash.deep_stringify_keys
end
@@ -133,7 +133,7 @@ module GitlabSettings
def symbolize_keys!
error_msg = "Warning: Do not mutate #{self.class} objects: `#{__method__}`"
- Gitlab::ErrorTracking.track_and_raise_for_dev_exception(RuntimeError.new(error_msg), method: __method__)
+ log_and_raise_dev_exception(error_msg, method: __method__)
to_hash.deep_symbolize_keys
end
@@ -151,7 +151,7 @@ module GitlabSettings
if @options.respond_to?(name)
error_msg = "Calling a hash method on #{self.class}: `#{name}`"
- Gitlab::ErrorTracking.track_and_raise_for_dev_exception(RuntimeError.new(error_msg), method: name)
+ log_and_raise_dev_exception(error_msg, method: name)
return @options.public_send(name, *args, &block) # rubocop: disable GitlabSecurity/PublicSend
end
@@ -164,5 +164,20 @@ module GitlabSettings
@options.respond_to?(name, include_all)
end
+
+ private
+
+ # We can't call Gitlab::ErrorTracking.track_and_raise_for_dev_exception
+ # because that method will attempt to load ApplicationContext and
+ # fail to load User since the Devise is not yet set up in
+ # `config/initialiers/8_devise.rb`.
+ def log_and_raise_dev_exception(message, extra = {})
+ raise message unless Rails.env.production?
+
+ # Gitlab::BacktraceCleaner drops config/initializers, so we just limit the
+ # backtrace to the first 10 lines.
+ payload = extra.merge(message: message, caller: caller[0..10])
+ Gitlab::AppJsonLogger.warn(payload)
+ end
end
end