Improve source patch error handling