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

Also handle a few edge cases / add some syntactic sugar