File tree 4 files changed +22
-4
lines changed
lib/active_support/core_ext
4 files changed +22
-4
lines changed 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
+
1
8
* Add support for error dispatcher classes in ` ActiveSupport::Rescuable ` .
2
9
Now it acts closer to Ruby's rescue.
3
10
Original file line number Diff line number Diff line change
1
+ require 'active_support/deprecation/proxy_wrappers'
2
+
1
3
class LoadError
2
4
REGEXPS = [
3
5
/^no such file to load -- (.+)$/i ,
@@ -25,4 +27,4 @@ def is_missing?(location)
25
27
end
26
28
end
27
29
28
- MissingSourceFile = LoadError
30
+ MissingSourceFile = ActiveSupport :: Deprecation :: DeprecatedConstantProxy . new ( 'MissingSourceFile' , ' LoadError' )
Original file line number Diff line number Diff line change 1
1
require 'abstract_unit'
2
2
require 'active_support/core_ext/load_error'
3
3
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
+
4
13
class TestLoadError < ActiveSupport ::TestCase
5
14
def test_with_require
6
15
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!
3873
3873
module_name = name.sub (/Controller$/ , ' ' )
3874
3874
module_path = module_name.underscore
3875
3875
helper module_path
3876
- rescue MissingSourceFile => e
3876
+ rescue LoadError => e
3877
3877
raise e unless e.is_missing? " helpers/#{ module_path } _helper"
3878
3878
rescue NameError => e
3879
3879
raise e unless e.missing_name? " #{ module_name } Helper"
@@ -3885,7 +3885,7 @@ NOTE: Defined in `active_support/core_ext/name_error.rb`.
3885
3885
Extensions to ` LoadError `
3886
3886
-------------------------
3887
3887
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 ` .
3889
3889
3890
3890
Given a path name ` is_missing? ` tests whether the exception was raised due to that particular file (except perhaps for the ".rb" extension).
3891
3891
@@ -3896,7 +3896,7 @@ def default_helper_module!
3896
3896
module_name = name.sub (/Controller$/ , ' ' )
3897
3897
module_path = module_name.underscore
3898
3898
helper module_path
3899
- rescue MissingSourceFile => e
3899
+ rescue LoadError => e
3900
3900
raise e unless e.is_missing? " helpers/#{ module_path } _helper"
3901
3901
rescue NameError => e
3902
3902
raise e unless e.missing_name? " #{ module_name } Helper"
You can’t perform that action at this time.
0 commit comments