@@ -37,18 +37,31 @@ def cache_in_memory(class_or_module, options={})
37
37
options . assert_valid_keys ( :path , :reference_name , :type )
38
38
39
39
path = options . fetch ( :path )
40
- modification_time = File . mtime ( path )
41
-
42
- parent_path = class_or_module . parent . parent_path
43
- reference_name = options . fetch ( :reference_name )
44
- type = options . fetch ( :type )
45
-
46
- module_info_by_path [ path ] = {
47
- :modification_time => modification_time ,
48
- :parent_path => parent_path ,
49
- :reference_name => reference_name ,
50
- :type => type
51
- }
40
+
41
+ begin
42
+ modification_time = File . mtime ( path )
43
+ rescue Errno ::ENOENT => error
44
+ log_lines = [ ]
45
+ log_lines << "Could not find the modification of time of #{ path } :"
46
+ log_lines << error . class . to_s
47
+ log_lines << error . to_s
48
+ log_lines << "Call stack:"
49
+ log_lines += error . backtrace
50
+
51
+ log_message = log_lines . join ( "\n " )
52
+ elog ( log_message )
53
+ else
54
+ parent_path = class_or_module . parent . parent_path
55
+ reference_name = options . fetch ( :reference_name )
56
+ type = options . fetch ( :type )
57
+
58
+ module_info_by_path [ path ] = {
59
+ :modification_time => modification_time ,
60
+ :parent_path => parent_path ,
61
+ :reference_name => reference_name ,
62
+ :type => type
63
+ }
64
+ end
52
65
end
53
66
54
67
# Forces loading of the module with the given type and module reference name from the cache.
0 commit comments