Exception rescuing.

This commit is contained in:
Luka Vandervelden 2019-10-01 12:44:11 +02:00
parent 0862bf4d4c
commit 66f7f42372

View File

@ -65,6 +65,19 @@ authd = AuthD::Client.new
key = authd_key
authd.key = key if key.is_a? String
# FIXME: Upstream this?
class IPC::Service
def loop(&block : Proc(IPC::Event::Connection | IPC::Event::Disconnection | IPC::Event::Message | IPC::Exception, Nil))
previous_def do |event|
begin
block.call event
rescue e
STDERR.puts "IPC::Service caught an exception: #{e}"
end
end
end
end
IPC::Service.new "kanban" do |event|
case event
when IPC::Event::Connection