The impact of cosmic dust on supernova cosmology