Fixed error reporting when build fails.