Better management of build failures

Handle build failures and throw a `BuildErrorException`

poke @joelwurtz I'd especially like your input on this one

Also, this PR most certainly conflicts with your other PR, but don't worry I'll do the merging :)