error handling in generic upload