On Mon, Mar 4, 2013 at 9:46 AM, Dominic Cleal <notifications@github.com>wrote:

> In lib/puppet/type.rb:
>
> > @@ -2195,7 +2195,13 @@ def initialize(resource)
> >
> >      set_parameters(@original_parameters)
> >
> > -    self.validate if self.respond_to?(:validate)
> > +    begin
> > +      self.validate if self.respond_to?(:validate)
> > +    rescue => detail
>
> @jeffmccune <https://github.com/jeffmccune> The same pattern of catching
> exceptions is used for individual parameter validation (circa line 656) so
> it seemed reasonable to me to reuse the pattern for resource validation.
> It's only going to catch StandardException derivatives, so signal handlers
> etc won't get caught.
>
> Yes, I noticed other behaviors in the same provider have catch all
handlers as well.  Even with these, I think it's a good improvement to try
and be more specific about the kinds of exceptions we're expecting to
handle.

That said, most validators use the fail function, so will be raising
> Puppet::Error. We could catch just this, but we should then change the
> parameter validation to do the same.
>
With this information, I think it's a good improvement to change all of
these to explicitly catch Puppet::Error type exceptions.  Would you mind
doing this as a separate commit since there are already prior examples?

-Jeff

>