+1

On Aug 23, 2009, at 4:23 PM, Markus Roberts wrote:

>
> This is a minor modification to the fail-wrapper for parameter
> errors to simplify the code and to preserve backtrace information
> (so that the stack will point to the source of the actual error
> rather than to the fail-wrapper itself).
>
> Signed-off-by: Markus Roberts <[email protected]>
> ---
> lib/puppet/parameter.rb |   20 ++++----------------
> 1 files changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/lib/puppet/parameter.rb b/lib/puppet/parameter.rb
> index f408667..1147be4 100644
> --- a/lib/puppet/parameter.rb
> +++ b/lib/puppet/parameter.rb
> @@ -374,23 +374,11 @@ class Puppet::Parameter
>     end
>
>     def fail(*args)
> -        type = nil
> -        if args[0].is_a?(Class)
> -            type = args.shift
> -        else
> -            type = Puppet::Error
> -        end
> -
> +        type = args[0].is_a?(Class) ? args.shift : Puppet::Error
>         error = type.new(args.join(" "))
> -
> -        if defined? @resource and @resource and @resource.line
> -            error.line = @resource.line
> -        end
> -
> -        if defined? @resource and @resource and @resource.file
> -            error.file = @resource.file
> -        end
> -
> +        error.line = @resource.line if @resource and @resource.line
> +        error.file = @resource.file if @resource and @resource.file
> +        error.set_backtrace args[0].backtrace if  
> args[0].respond_to? :backtrace
>         raise error
>     end
>
> -- 
> 1.6.0.4
>
>
> >


-- 
Sometimes I think we're alone. Sometimes I think we're not. In
either case, the thought is staggering. --R. Buckminster Fuller
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to