Cleanup exception handling

Use one central place to define exceptions for error
conditions and build states