Deletes AS::Dependencies::Blamable
This is an internal class which is no longer needed.
This commit is contained in:
parent
90d0b42bd8
commit
43a7f68ae3
|
@ -1,10 +1,3 @@
|
||||||
<% unless @exception.blamed_files.blank? %>
|
|
||||||
<% if (hide = @exception.blamed_files.length > 8) %>
|
|
||||||
<a href="#" onclick="return toggleTrace()">Toggle blamed files</a>
|
|
||||||
<% end %>
|
|
||||||
<pre id="blame_trace" <%='style="display:none"' if hide %>><code><%= @exception.describe_blame %></code></pre>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<h2 style="margin-top: 30px">Request</h2>
|
<h2 style="margin-top: 30px">Request</h2>
|
||||||
<% if params_valid? %>
|
<% if params_valid? %>
|
||||||
<p><b>Parameters</b>:</p> <pre><%= debug_params(@request.filtered_parameters) %></pre>
|
<p><b>Parameters</b>:</p> <pre><%= debug_params(@request.filtered_parameters) %></pre>
|
||||||
|
|
|
@ -239,9 +239,6 @@
|
||||||
var hide = function(id) {
|
var hide = function(id) {
|
||||||
document.getElementById(id).style.display = 'none';
|
document.getElementById(id).style.display = 'none';
|
||||||
}
|
}
|
||||||
var toggleTrace = function() {
|
|
||||||
return toggle('blame_trace');
|
|
||||||
}
|
|
||||||
var toggleSessionDump = function() {
|
var toggleSessionDump = function() {
|
||||||
return toggle('session_dump');
|
return toggle('session_dump');
|
||||||
}
|
}
|
||||||
|
|
|
@ -298,9 +298,6 @@ module ActiveSupport #:nodoc:
|
||||||
else
|
else
|
||||||
yield
|
yield
|
||||||
end
|
end
|
||||||
rescue Exception => exception # errors from loading file
|
|
||||||
exception.blame_file! file if exception.respond_to? :blame_file!
|
|
||||||
raise
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Mark the given constant as unloadable. Unloadable constants are removed
|
# Mark the given constant as unloadable. Unloadable constants are removed
|
||||||
|
@ -334,31 +331,9 @@ module ActiveSupport #:nodoc:
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Exception file-blaming.
|
|
||||||
module Blamable #:nodoc:
|
|
||||||
def blame_file!(file)
|
|
||||||
(@blamed_files ||= []).unshift file
|
|
||||||
end
|
|
||||||
|
|
||||||
def blamed_files
|
|
||||||
@blamed_files ||= []
|
|
||||||
end
|
|
||||||
|
|
||||||
def describe_blame
|
|
||||||
return nil if blamed_files.empty?
|
|
||||||
"This error occurred while loading the following files:\n #{blamed_files.join "\n "}"
|
|
||||||
end
|
|
||||||
|
|
||||||
def copy_blame!(exc)
|
|
||||||
@blamed_files = exc.blamed_files.clone
|
|
||||||
self
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def hook!
|
def hook!
|
||||||
Loadable.include_into(Object)
|
Loadable.include_into(Object)
|
||||||
ModuleConstMissing.include_into(Module)
|
ModuleConstMissing.include_into(Module)
|
||||||
Exception.include(Blamable)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def unhook!
|
def unhook!
|
||||||
|
@ -381,7 +356,6 @@ module ActiveSupport #:nodoc:
|
||||||
load_error.message
|
load_error.message
|
||||||
end
|
end
|
||||||
load_error_message.replace(message % file_name)
|
load_error_message.replace(message % file_name)
|
||||||
load_error.copy_blame!(load_error)
|
|
||||||
end
|
end
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
exception = Exception.new("I am not blamable!")
|
|
||||||
class << exception
|
|
||||||
undef_method(:blame_file!)
|
|
||||||
end
|
|
||||||
raise exception
|
|
|
@ -104,13 +104,6 @@ class DependenciesTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dependency_which_raises_doesnt_blindly_call_blame_file!
|
|
||||||
with_loading do
|
|
||||||
filename = "dependencies/raises_exception_without_blame_file"
|
|
||||||
assert_raises(Exception) { require_dependency filename }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def test_warnings_should_be_enabled_on_first_load
|
def test_warnings_should_be_enabled_on_first_load
|
||||||
with_loading "dependencies" do
|
with_loading "dependencies" do
|
||||||
old_warnings, ActiveSupport::Dependencies.warnings_on_first_load = ActiveSupport::Dependencies.warnings_on_first_load, true
|
old_warnings, ActiveSupport::Dependencies.warnings_on_first_load = ActiveSupport::Dependencies.warnings_on_first_load, true
|
||||||
|
|
Loading…
Reference in New Issue