Tracking Errors through Types in Quantum Programs