Exit Code from docker-compose build

How do you determine if docker-compose build failed?

I have a ps1 that first docker-compose build, then runs docker-compose up. However, if something fails during build, I would like to prevent the up from executing.

I’ve looked all across the interwebz with very little information.