Add a lot of error-handling code to the Download class.