Exception rescuing.

master
Luka Vandervelden 4 years ago
parent 0862bf4d4c
commit 66f7f42372

@ -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

Loading…
Cancel
Save