Exception rescuing.
This commit is contained in:
parent
0862bf4d4c
commit
66f7f42372
13
src/main.cr
13
src/main.cr
@ -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…
Reference in New Issue
Block a user