Fix #37: raise errors on build failures

Also handle a few edge cases / add some syntactic sugar