tasks/database/annotate.rb in pact_broker-2.42.0 vs tasks/database/annotate.rb in pact_broker-2.43.0
- old
+ new
@@ -2,20 +2,28 @@
module PactBroker
class Annotate
def self.call
annotation_configuration.each_pair do | klass, path |
- puts "Annotating #{klass}"
- sa = Sequel::Annotate.new(klass)
- sa.annotate(path)
+ begin
+ puts "Annotating #{klass}"
+ sa = Sequel::Annotate.new(klass)
+ sa.annotate(path)
+ rescue StandardError => e
+ puts "Error annnotating #{klass} - #{e.message}\n#{e.backtrace.join("\n")}"
+ end
end
end
def self.annotation_configuration
sequel_domain_classes.each_with_object({}) do | klass, configs |
file_path = file_path_for_class(klass)
if File.exist?(file_path)
- configs[klass] = file_path
+ if klass.db.table_exists?(klass.table_name)
+ configs[klass] = file_path
+ else
+ puts "Skipping annotation for #{klass} as the configured table_name '#{klass.table_name}' is not a real table"
+ end
else
puts "Skipping annotation for #{klass} as the generated file path #{file_path} does not exist"
end
end
end