Class: PactBroker::DB::LogQuietener

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/pact_broker/db/log_quietener.rb

Instance Method Summary collapse

Instance Method Details

#error(*args) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/pact_broker/db/log_quietener.rb', line 16

def error *args
  if error_is_about_table_not_existing?(args)
    __getobj__().debug(*reassure_people_that_this_is_expected(args))
  else
    __getobj__().error(*args)
  end
end

#error_is_about_table_not_existing?(args) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
# File 'lib/pact_broker/db/log_quietener.rb', line 24

def error_is_about_table_not_existing?(args)
  args.first.is_a?(String) &&
    ( args.first.include?("PG::UndefinedTable") ||
      args.first.include?("no such table") ||
      args.first.include?("no such view"))
end

#info(*args) ⇒ Object



12
13
14
# File 'lib/pact_broker/db/log_quietener.rb', line 12

def info *args
  __getobj__().debug(*args)
end

#reassure_people_that_this_is_expected(args) ⇒ Object



31
32
33
34
35
# File 'lib/pact_broker/db/log_quietener.rb', line 31

def reassure_people_that_this_is_expected(args)
  message = args.shift
  message = message + " Don't panic. This happens when Sequel doesn't know if a table/view exists or not."
  [message] + args
end