Improve error handling in gulp tasks