enahnced error handling in build.ps1