File tree Expand file tree Collapse file tree
lib/active_support/core_ext Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ * Deprecate ` MissingSourceFile ` in favor of ` LoadError ` .
2+
3+ ` MissingSourceFile ` was just an alias to ` LoadError ` and was not being
4+ raised inside the framework.
5+
6+ * Rafael Mendonça França*
7+
18* Add support for error dispatcher classes in ` ActiveSupport::Rescuable ` .
29 Now it acts closer to Ruby's rescue.
310
Original file line number Diff line number Diff line change 1+ require 'active_support/deprecation/proxy_wrappers'
2+
13class LoadError
24 REGEXPS = [
35 /^no such file to load -- (.+)$/i ,
@@ -25,4 +27,4 @@ def is_missing?(location)
2527 end
2628end
2729
28- MissingSourceFile = LoadError
30+ MissingSourceFile = ActiveSupport :: Deprecation :: DeprecatedConstantProxy . new ( 'MissingSourceFile' , ' LoadError' )
Original file line number Diff line number Diff line change 11require 'abstract_unit'
22require 'active_support/core_ext/load_error'
33
4+
5+ class TestMissingSourceFile < ActiveSupport ::TestCase
6+ def test_it_is_deprecated
7+ assert_deprecated do
8+ MissingSourceFile . new
9+ end
10+ end
11+ end
12+
413class TestLoadError < ActiveSupport ::TestCase
514 def test_with_require
615 assert_raise ( LoadError ) { require 'no_this_file_don\'t_exist' }
Original file line number Diff line number Diff line change @@ -3873,7 +3873,7 @@ def default_helper_module!
38733873 module_name = name.sub (/Controller$/ , ' ' )
38743874 module_path = module_name.underscore
38753875 helper module_path
3876- rescue MissingSourceFile => e
3876+ rescue LoadError => e
38773877 raise e unless e.is_missing? " helpers/#{ module_path } _helper"
38783878rescue NameError => e
38793879 raise e unless e.missing_name? " #{ module_name } Helper"
@@ -3885,7 +3885,7 @@ NOTE: Defined in `active_support/core_ext/name_error.rb`.
38853885Extensions to ` LoadError `
38863886-------------------------
38873887
3888- Active Support adds ` is_missing? ` to ` LoadError ` , and also assigns that class to the constant ` MissingSourceFile ` for backwards compatibility .
3888+ Active Support adds ` is_missing? ` to ` LoadError ` .
38893889
38903890Given a path name ` is_missing? ` tests whether the exception was raised due to that particular file (except perhaps for the ".rb" extension).
38913891
@@ -3896,7 +3896,7 @@ def default_helper_module!
38963896 module_name = name.sub (/Controller$/ , ' ' )
38973897 module_path = module_name.underscore
38983898 helper module_path
3899- rescue MissingSourceFile => e
3899+ rescue LoadError => e
39003900 raise e unless e.is_missing? " helpers/#{ module_path } _helper"
39013901rescue NameError => e
39023902 raise e unless e.missing_name? " #{ module_name } Helper"
You can’t perform that action at this time.
0 commit comments