catching some events / exceptions (exiting, server unreachable, enter pressed...)