Sha256: 0e122674ebb4f8058c3d6374892668e39c60b18b0367c6d317bda59f2e611a8d
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
# frozen_string_literal: true module Caddy class TaskObserver def update(_, _, boom) return unless boom if Caddy.error_handler if Caddy.error_handler.respond_to?(:call) begin Caddy.error_handler.call(boom) rescue => incepted_boom puts_exception("Caddy error handler itself errored", incepted_boom) end else # rubocop:disable Style/StringLiterals STDERR.puts 'Caddy error handler not callable. Please set the error handler like:'\ ' `Caddy.error_handler = -> (e) { puts "#{e}" }`' # rubocop:enable Style/StringLiterals puts_exception("Caddy refresher failed with error", boom) end elsif boom.is_a?(Concurrent::TimeoutError) STDERR.puts "Caddy refresher timed out" else puts_exception("Caddy refresher failed with error", boom) end end private def puts_exception(msg, boom) STDERR.puts "\n#{msg}: #{boom}" STDERR.puts "\t#{boom.backtrace.join("\n\t")}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
caddy-1.0.1 | lib/caddy/task_observer.rb |
caddy-1.0.0 | lib/caddy/task_observer.rb |