MainLoop: improve error handling
am: fd59221459

Change-Id: Ica2fb6ca49c57286c661763192a0f45a23e899c9