aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2019-04-11 22:43:45 +0200
committerXavier Noria <fxn@hashref.com>2019-04-11 23:10:13 +0200
commit7b6b10542d5dac2b50f2578143dc5d70120d1146 (patch)
tree97faab6b3ebdd667a068d8955ecfa8ffa392a589 /activesupport/lib
parent23392eff9f8065475739e58232a5db97604f8056 (diff)
downloadrails-7b6b10542d5dac2b50f2578143dc5d70120d1146.tar.gz
rails-7b6b10542d5dac2b50f2578143dc5d70120d1146.tar.bz2
rails-7b6b10542d5dac2b50f2578143dc5d70120d1146.zip
improves the reloading disabled error message
The original message from Zeitwerk is "can't reload, please call loader.enable_reloading before setup (Zeitwerk::Error)", which is not very informative for Rails programmers. Rails should err with a message worded in terms of its interface.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/dependencies/zeitwerk_integration.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb b/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
index b0f7a3f9cc..f16a9f7e57 100644
--- a/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
+++ b/activesupport/lib/active_support/dependencies/zeitwerk_integration.rb
@@ -9,7 +9,11 @@ module ActiveSupport
module Decorations
def clear
Dependencies.unload_interlock do
- Rails.autoloaders.main.reload
+ begin
+ Rails.autoloaders.main.reload
+ rescue Zeitwerk::ReloadingDisabledError
+ raise "reloading is disabled because config.cache_classes is true"
+ end
end
end