Exception rescuing.

master
Luka Vandervelden 2019-10-01 12:44:11 +02:00
parent 0862bf4d4c
commit 66f7f42372
1 changed files with 13 additions and 0 deletions

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