Handle build errors more neatly

I ran into a couple of issues with the error handling, the problem is that if the build completes before a request is made, the promise is resolved without an error catcher.

A small fix, but in order to reproduce in the test, I had to juggle around a little bit.

Since I was attaching an error handler to the promise, I figured it might as well exposed to the public api.