On Sat, 2012-09-22 at 00:33 +0200, [email protected] wrote:
> From: Michal Fojtik <[email protected]>
> 
> This patch fixed the case when the exception DSL is
> used more than once (typically on driver switching).
> In that case the new exceptions will override the exceptions
> from the previous driver.
> 
> Signed-off-by: Michal fojtik <[email protected]>

ACK; one nit:

> diff --git a/server/lib/deltacloud/drivers/exceptions.rb 
> b/server/lib/deltacloud/drivers/exceptions.rb
> index 5e679a5..1a635ce 100644
> --- a/server/lib/deltacloud/drivers/exceptions.rb
> +++ b/server/lib/deltacloud/drivers/exceptions.rb
> @@ -171,9 +171,15 @@ module Deltacloud
>        end
>      end
>  
> -    def self.exceptions(&block)
> -      @definitions = Exceptions.new(&block).exception_definitions if 
> block_given?
> -      @definitions
> +    module DSL
> +      def exceptions(&block)
> +        @definitions = Exceptions.new(&block).exception_definitions if 
> block_given?
> +        @definitions
> +      end
> +    end

You should initialize @definitions ||= [] to make sure that drivers
without exception definitions don't cause an error in safely trying to
call each on nil.


Reply via email to