Module: Photish::Log::SafeBlock

Included in:
Command::Base
Defined in:
lib/photish/log/safe_block.rb

Instance Method Summary collapse

Instance Method Details

#handle_errors(name) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/photish/log/safe_block.rb', line 4

def handle_errors(name)
  begin
    yield
  rescue ScriptError, SignalException, StandardError, SystemExit => e
    log.fatal "#{name} died due to #{e.class.name}"
    log.fatal e unless e.kind_of?(SystemExit)
    Thread.list.each(&:kill)
    exit(1)
  end
end