Refactor manage-projects for readability

This changes absolutely no functionality - it's merely extracting parts
of the really long function into subfunctions. It should make further
refactoring of sequencing and error conditions easier to reason about.

Change-Id: I288a03f631faa1b4596e3fd5d5e1613ff2525b6e
Catch errors centrally, and bail out more

We want to be more resilient against parts of things failing. For that,
we need to be able to bail out of the loop when things bork. Put in a
central loop exception processor, and throw things from the functions.

Change-Id: I5d9b30e1403634909ad45c27af7c975d815a9538
Merge "Refactor manage-projects for readability"
Merge "Catch errors centrally, and bail out more"