Fix #37: raise errors on build failures (rev 4)

Also handle a few edge cases / add some syntactic sugar