You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(PUP-11472) Add source_ref to legacy function error
Prior to the commit the illegal error message only included the method
name and line number, but this makes finding the source file difficult.
After this commit the source file name is included in the error message.
raiseArgumentError,_("The code loaded from %{source_ref} does not seem to be a Puppet 3x API function - no 'newfunction' call.") % {source_ref: source_ref}
returnfalseifripped.nil?# Let the next real parse crash and tell where and what is wrong
75
-
ripped.each{|x| walk(x,result)}
75
+
ripped.each{|x| walk(x,source_ref,result)}
76
76
true
77
77
end
78
78
private_class_method:assert_code
79
79
80
-
defself.walk(x,result)
80
+
defself.walk(x,source_ref,result)
81
81
returnunlessx.is_a?(Array)
82
82
first=x[0]
83
83
casefirst
@@ -89,13 +89,14 @@ def self.walk(x, result)
89
89
when:def,:defs
90
90
# There should not be any calls to def in a 3x function
91
91
mname,mline=extract_name_line(find_identity(x))
92
-
raiseSecurityError,_("Illegal method definition of method '%{method_name}' on line %{line} in legacy function. See %{url} for more information") % {
92
+
raiseSecurityError,_("Illegal method definition of method '%{method_name}' in source %{source_ref} on line %{line} in legacy function. See %{url} for more information") % {
}.toraise_error(SecurityError,/Illegal method definition of method 'bad_func_load3_illegal_method' on line 8 in legacy function/)
609
+
}.toraise_error(SecurityError,/Illegal method definition of method 'bad_func_load3_illegal_method' in source .*bad_func_load3.rb on line 8 in legacy function/)
0 commit comments