Add better error handing to build