Error handling.

Some minor cleanups, but mostly properly handling bad error
cases by really exiting and following up on the error condition
properly.