Log handled exceptions and try to reconnect in some cases.