From b63862ff43194194f7428739a32cfe13bad1e7ed Mon Sep 17 00:00:00 2001 From: Helen Campbell Date: Tue, 6 Sep 2016 15:00:07 +0100 Subject: Addition of logging with file and line numbers --- lib/puppet/functions/validate_legacy.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/puppet/functions/validate_legacy.rb') diff --git a/lib/puppet/functions/validate_legacy.rb b/lib/puppet/functions/validate_legacy.rb index 9d7d012..b1066e2 100644 --- a/lib/puppet/functions/validate_legacy.rb +++ b/lib/puppet/functions/validate_legacy.rb @@ -28,8 +28,10 @@ Puppet::Functions.create_function(:validate_legacy, Puppet::Functions::InternalF Puppet.warn("Accepting previously invalid value for target_type '#{target_type}'") end else + caller_infos = caller.first.split(":") inferred_type = Puppet::Pops::Types::TypeCalculator.infer_set(value) - error_msg = Puppet::Pops::Types::TypeMismatchDescriber.new.describe_mismatch(previous_validation, target_type, inferred_type) + message = Puppet::Pops::Types::TypeMismatchDescriber.new.describe_mismatch(previous_validation, target_type, inferred_type) + error_msg = "#{message} : #{caller_infos[0]} : #{caller_infos[1]}" if previous_validation(previous_validation, value, *prev_args) Puppet.warn(error_msg) else -- cgit v1.2.3